133 lines
4.0 KiB
Go
133 lines
4.0 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package models
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// CreateStatusOption CreateStatusOption holds the information needed to create a new CommitStatus for a Commit
|
|
//
|
|
// swagger:model CreateStatusOption
|
|
type CreateStatusOption struct {
|
|
|
|
// Context is the unique context identifier for the status
|
|
Context string `json:"context,omitempty"`
|
|
|
|
// Description provides a brief description of the status
|
|
Description string `json:"description,omitempty"`
|
|
|
|
// State represents the status state to set (pending, success, error, failure)
|
|
// pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending
|
|
// success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success
|
|
// error CommitStatusError CommitStatusError is for when the CommitStatus is Error
|
|
// failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure
|
|
// warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning
|
|
// skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped
|
|
// Enum: ["pending","success","error","failure","warning","skipped"]
|
|
State string `json:"state,omitempty"`
|
|
|
|
// TargetURL is the URL to link to for more details
|
|
TargetURL string `json:"target_url,omitempty"`
|
|
}
|
|
|
|
// Validate validates this create status option
|
|
func (m *CreateStatusOption) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateState(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
var createStatusOptionTypeStatePropEnum []interface{}
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["pending","success","error","failure","warning","skipped"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
createStatusOptionTypeStatePropEnum = append(createStatusOptionTypeStatePropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// CreateStatusOptionStatePending captures enum value "pending"
|
|
CreateStatusOptionStatePending string = "pending"
|
|
|
|
// CreateStatusOptionStateSuccess captures enum value "success"
|
|
CreateStatusOptionStateSuccess string = "success"
|
|
|
|
// CreateStatusOptionStateError captures enum value "error"
|
|
CreateStatusOptionStateError string = "error"
|
|
|
|
// CreateStatusOptionStateFailure captures enum value "failure"
|
|
CreateStatusOptionStateFailure string = "failure"
|
|
|
|
// CreateStatusOptionStateWarning captures enum value "warning"
|
|
CreateStatusOptionStateWarning string = "warning"
|
|
|
|
// CreateStatusOptionStateSkipped captures enum value "skipped"
|
|
CreateStatusOptionStateSkipped string = "skipped"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *CreateStatusOption) validateStateEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, createStatusOptionTypeStatePropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *CreateStatusOption) validateState(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.State) { // not required
|
|
return nil
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateStateEnum("state", "body", m.State); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this create status option based on context it is used
|
|
func (m *CreateStatusOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *CreateStatusOption) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *CreateStatusOption) UnmarshalBinary(b []byte) error {
|
|
var res CreateStatusOption
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|