cloud/azure/batch/models/exit_conditions.go
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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
// ExitConditions Specifies how the Batch service should respond when the task completes.
// swagger:model ExitConditions
type ExitConditions struct {
// How the Batch service should respond if the task fails with an exit condition not covered by any of the other properties – that is, any nonzero exit code not listed in the exitCodes or exitCodeRanges collection, or a scheduling error if the schedulingError property is not present.
//
// Note that the default condition does not include exit code 0. If you want non-default behaviour on exit code 0, you must list it explicitly using the exitCodes or exitCodeRanges collection.
Default *ExitOptions `json:"default,omitempty"`
// A list of task exit code ranges and how the Batch service should respond to them.
ExitCodeRanges []*ExitCodeRangeMapping `json:"exitCodeRanges"`
// A list of individual task exit codes and how the Batch service should respond to them.
ExitCodes []*ExitCodeMapping `json:"exitCodes"`
// How the Batch service should respond if the task fails with a scheduling error.
SchedulingError *ExitOptions `json:"schedulingError,omitempty"`
}
// Validate validates this exit conditions
func (m *ExitConditions) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDefault(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateExitCodeRanges(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateExitCodes(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateSchedulingError(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ExitConditions) validateDefault(formats strfmt.Registry) error {
if swag.IsZero(m.Default) { // not required
return nil
}
if m.Default != nil {
if err := m.Default.Validate(formats); err != nil {
return err
}
}
return nil
}
func (m *ExitConditions) validateExitCodeRanges(formats strfmt.Registry) error {
if swag.IsZero(m.ExitCodeRanges) { // not required
return nil
}
for i := 0; i < len(m.ExitCodeRanges); i++ {
if swag.IsZero(m.ExitCodeRanges[i]) { // not required
continue
}
if m.ExitCodeRanges[i] != nil {
if err := m.ExitCodeRanges[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}
func (m *ExitConditions) validateExitCodes(formats strfmt.Registry) error {
if swag.IsZero(m.ExitCodes) { // not required
return nil
}
for i := 0; i < len(m.ExitCodes); i++ {
if swag.IsZero(m.ExitCodes[i]) { // not required
continue
}
if m.ExitCodes[i] != nil {
if err := m.ExitCodes[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}
func (m *ExitConditions) validateSchedulingError(formats strfmt.Registry) error {
if swag.IsZero(m.SchedulingError) { // not required
return nil
}
if m.SchedulingError != nil {
if err := m.SchedulingError.Validate(formats); err != nil {
return err
}
}
return nil
}