343 lines
7.7 KiB
Go
343 lines
7.7 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"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// ActionWorkflowRun ActionWorkflowRun represents a WorkflowRun
|
|
//
|
|
// swagger:model ActionWorkflowRun
|
|
type ActionWorkflowRun struct {
|
|
|
|
// completed at
|
|
// Format: date-time
|
|
CompletedAt strfmt.DateTime `json:"completed_at,omitempty"`
|
|
|
|
// conclusion
|
|
Conclusion string `json:"conclusion,omitempty"`
|
|
|
|
// display title
|
|
DisplayTitle string `json:"display_title,omitempty"`
|
|
|
|
// event
|
|
Event string `json:"event,omitempty"`
|
|
|
|
// HTML URL
|
|
HTMLURL string `json:"html_url,omitempty"`
|
|
|
|
// head branch
|
|
HeadBranch string `json:"head_branch,omitempty"`
|
|
|
|
// head sha
|
|
HeadSha string `json:"head_sha,omitempty"`
|
|
|
|
// ID
|
|
ID int64 `json:"id,omitempty"`
|
|
|
|
// path
|
|
Path string `json:"path,omitempty"`
|
|
|
|
// repository ID
|
|
RepositoryID int64 `json:"repository_id,omitempty"`
|
|
|
|
// run attempt
|
|
RunAttempt int64 `json:"run_attempt,omitempty"`
|
|
|
|
// run number
|
|
RunNumber int64 `json:"run_number,omitempty"`
|
|
|
|
// started at
|
|
// Format: date-time
|
|
StartedAt strfmt.DateTime `json:"started_at,omitempty"`
|
|
|
|
// status
|
|
Status string `json:"status,omitempty"`
|
|
|
|
// URL
|
|
URL string `json:"url,omitempty"`
|
|
|
|
// actor
|
|
Actor *User `json:"actor,omitempty"`
|
|
|
|
// head repository
|
|
HeadRepository *Repository `json:"head_repository,omitempty"`
|
|
|
|
// repository
|
|
Repository *Repository `json:"repository,omitempty"`
|
|
|
|
// trigger actor
|
|
TriggerActor *User `json:"trigger_actor,omitempty"`
|
|
}
|
|
|
|
// Validate validates this action workflow run
|
|
func (m *ActionWorkflowRun) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateCompletedAt(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateStartedAt(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateActor(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateHeadRepository(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRepository(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTriggerActor(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) validateCompletedAt(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.CompletedAt) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("completed_at", "body", "date-time", m.CompletedAt.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) validateStartedAt(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.StartedAt) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("started_at", "body", "date-time", m.StartedAt.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) validateActor(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Actor) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Actor != nil {
|
|
if err := m.Actor.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("actor")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("actor")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) validateHeadRepository(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.HeadRepository) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.HeadRepository != nil {
|
|
if err := m.HeadRepository.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("head_repository")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("head_repository")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) validateRepository(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Repository) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Repository != nil {
|
|
if err := m.Repository.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("repository")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("repository")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) validateTriggerActor(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.TriggerActor) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.TriggerActor != nil {
|
|
if err := m.TriggerActor.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("trigger_actor")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("trigger_actor")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this action workflow run based on the context it is used
|
|
func (m *ActionWorkflowRun) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateActor(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateHeadRepository(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateRepository(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateTriggerActor(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) contextValidateActor(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Actor != nil {
|
|
|
|
if swag.IsZero(m.Actor) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Actor.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("actor")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("actor")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) contextValidateHeadRepository(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.HeadRepository != nil {
|
|
|
|
if swag.IsZero(m.HeadRepository) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.HeadRepository.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("head_repository")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("head_repository")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) contextValidateRepository(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Repository != nil {
|
|
|
|
if swag.IsZero(m.Repository) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Repository.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("repository")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("repository")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ActionWorkflowRun) contextValidateTriggerActor(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.TriggerActor != nil {
|
|
|
|
if swag.IsZero(m.TriggerActor) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.TriggerActor.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("trigger_actor")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("trigger_actor")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *ActionWorkflowRun) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *ActionWorkflowRun) UnmarshalBinary(b []byte) error {
|
|
var res ActionWorkflowRun
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|