jkawamoto/roadie

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

Summary

Maintainability
B
6 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 (
    "encoding/json"

    strfmt "github.com/go-openapi/strfmt"
    "github.com/go-openapi/swag"

    "github.com/go-openapi/errors"
    "github.com/go-openapi/validate"
)

// NodeDisableSchedulingParameter Options for disabling scheduling on a compute node.
// swagger:model NodeDisableSchedulingParameter
type NodeDisableSchedulingParameter struct {

    // What to do with currently running tasks when disabling task scheduling on the compute node.
    //
    // The default value is requeue.
    NodeDisableSchedulingOption string `json:"nodeDisableSchedulingOption,omitempty"`
}

// Validate validates this node disable scheduling parameter
func (m *NodeDisableSchedulingParameter) Validate(formats strfmt.Registry) error {
    var res []error

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

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

var nodeDisableSchedulingParameterTypeNodeDisableSchedulingOptionPropEnum []interface{}

func init() {
    var res []string
    if err := json.Unmarshal([]byte(`["requeue","terminate","taskcompletion"]`), &res); err != nil {
        panic(err)
    }
    for _, v := range res {
        nodeDisableSchedulingParameterTypeNodeDisableSchedulingOptionPropEnum = append(nodeDisableSchedulingParameterTypeNodeDisableSchedulingOptionPropEnum, v)
    }
}

const (
    // NodeDisableSchedulingParameterNodeDisableSchedulingOptionRequeue captures enum value "requeue"
    NodeDisableSchedulingParameterNodeDisableSchedulingOptionRequeue string = "requeue"
    // NodeDisableSchedulingParameterNodeDisableSchedulingOptionTerminate captures enum value "terminate"
    NodeDisableSchedulingParameterNodeDisableSchedulingOptionTerminate string = "terminate"
    // NodeDisableSchedulingParameterNodeDisableSchedulingOptionTaskcompletion captures enum value "taskcompletion"
    NodeDisableSchedulingParameterNodeDisableSchedulingOptionTaskcompletion string = "taskcompletion"
)

// prop value enum
func (m *NodeDisableSchedulingParameter) validateNodeDisableSchedulingOptionEnum(path, location string, value string) error {
    if err := validate.Enum(path, location, value, nodeDisableSchedulingParameterTypeNodeDisableSchedulingOptionPropEnum); err != nil {
        return err
    }
    return nil
}

func (m *NodeDisableSchedulingParameter) validateNodeDisableSchedulingOption(formats strfmt.Registry) error {

    if swag.IsZero(m.NodeDisableSchedulingOption) { // not required
        return nil
    }

    // value enum
    if err := m.validateNodeDisableSchedulingOptionEnum("nodeDisableSchedulingOption", "body", m.NodeDisableSchedulingOption); err != nil {
        return err
    }

    return nil
}