jkawamoto/roadie

View on GitHub
cloud/azure/batch/models/exit_code_mapping.go

Summary

Maintainability
B
5 hrs
Test Coverage
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/errors"
    "github.com/go-openapi/validate"
)

// ExitCodeMapping How the Batch service should respond if a task exits with a particular exit code.
// swagger:model ExitCodeMapping
type ExitCodeMapping struct {

    // A process exit code.
    // Required: true
    Code *int32 `json:"code"`

    // How the Batch service should respond if the task exits with this exit code.
    // Required: true
    ExitOptions *ExitOptions `json:"exitOptions"`
}

// Validate validates this exit code mapping
func (m *ExitCodeMapping) Validate(formats strfmt.Registry) error {
    var res []error

    if err := m.validateCode(formats); err != nil {
        // prop
        res = append(res, err)
    }

    if err := m.validateExitOptions(formats); err != nil {
        // prop
        res = append(res, err)
    }

    if len(res) > 0 {
        return errors.CompositeValidationError(res...)
    }
    return nil
}

func (m *ExitCodeMapping) validateCode(formats strfmt.Registry) error {

    if err := validate.Required("code", "body", m.Code); err != nil {
        return err
    }

    return nil
}

func (m *ExitCodeMapping) validateExitOptions(formats strfmt.Registry) error {

    if err := validate.Required("exitOptions", "body", m.ExitOptions); err != nil {
        return err
    }

    if m.ExitOptions != nil {

        if err := m.ExitOptions.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}