jkawamoto/roadie

View on GitHub
cloud/azure/batch/models/task_add_parameter.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/swag"

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

// TaskAddParameter An Azure Batch task to add.
// swagger:model TaskAddParameter
type TaskAddParameter struct {

    // A locality hint that can be used by the Batch service to select a compute node on which to start the new task.
    AffinityInfo *AffinityInformation `json:"affinityInfo,omitempty"`

    // A list of application packages that the Batch service will deploy to the compute node before running the command line.
    ApplicationPackageReferences []*ApplicationPackageReference `json:"applicationPackageReferences"`

    // The command line of the task.
    //
    // For multi-instance tasks, the command line is executed as the primary task, after the primary task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux.
    // Required: true
    CommandLine *string `json:"commandLine"`

    // The execution constraints that apply to this task.
    //
    // If you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the job, and the maxWallClockTime and retentionTime are infinite.
    Constraints *TaskConstraints `json:"constraints,omitempty"`

    // The tasks that this task depends on.
    //
    // The task will not be scheduled until all depended-on tasks have completed successfully. (If any depended-on tasks fail and exhaust their retry counts, the task will never be scheduled.) If the job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob.
    DependsOn *TaskDependencies `json:"dependsOn,omitempty"`

    // A display name for the task.
    //
    // The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.
    DisplayName string `json:"displayName,omitempty"`

    // A list of environment variable settings for the task.
    EnvironmentSettings []*EnvironmentSetting `json:"environmentSettings"`

    // How the Batch service should respond when the task completes.
    ExitConditions *ExitConditions `json:"exitConditions,omitempty"`

    // A string that uniquely identifies the task within the job.
    //
    // The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a job that differ only by case).
    // Required: true
    ID *string `json:"id"`

    // An object that indicates that the task is a multi-instance task, and contains information about how to run the multi-instance task.
    MultiInstanceSettings *MultiInstanceSettings `json:"multiInstanceSettings,omitempty"`

    // A list of files that the Batch service will download to the compute node before running the command line.
    //
    // For multi-instance tasks, the resource files will only be downloaded to the compute node on which the primary task is executed.
    ResourceFiles []*ResourceFile `json:"resourceFiles"`

    // Whether to run the task in elevated mode.
    //
    // The default value is false.
    RunElevated bool `json:"runElevated,omitempty"`
}

// Validate validates this task add parameter
func (m *TaskAddParameter) Validate(formats strfmt.Registry) error {
    var res []error

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

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

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

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

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

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

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

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

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

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

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

func (m *TaskAddParameter) validateAffinityInfo(formats strfmt.Registry) error {

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

    if m.AffinityInfo != nil {

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

    return nil
}

func (m *TaskAddParameter) validateApplicationPackageReferences(formats strfmt.Registry) error {

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

    for i := 0; i < len(m.ApplicationPackageReferences); i++ {

        if swag.IsZero(m.ApplicationPackageReferences[i]) { // not required
            continue
        }

        if m.ApplicationPackageReferences[i] != nil {

            if err := m.ApplicationPackageReferences[i].Validate(formats); err != nil {
                return err
            }
        }

    }

    return nil
}

func (m *TaskAddParameter) validateCommandLine(formats strfmt.Registry) error {

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

    return nil
}

func (m *TaskAddParameter) validateConstraints(formats strfmt.Registry) error {

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

    if m.Constraints != nil {

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

    return nil
}

func (m *TaskAddParameter) validateDependsOn(formats strfmt.Registry) error {

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

    if m.DependsOn != nil {

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

    return nil
}

func (m *TaskAddParameter) validateEnvironmentSettings(formats strfmt.Registry) error {

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

    for i := 0; i < len(m.EnvironmentSettings); i++ {

        if swag.IsZero(m.EnvironmentSettings[i]) { // not required
            continue
        }

        if m.EnvironmentSettings[i] != nil {

            if err := m.EnvironmentSettings[i].Validate(formats); err != nil {
                return err
            }
        }

    }

    return nil
}

func (m *TaskAddParameter) validateExitConditions(formats strfmt.Registry) error {

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

    if m.ExitConditions != nil {

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

    return nil
}

func (m *TaskAddParameter) validateID(formats strfmt.Registry) error {

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

    return nil
}

func (m *TaskAddParameter) validateMultiInstanceSettings(formats strfmt.Registry) error {

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

    if m.MultiInstanceSettings != nil {

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

    return nil
}

func (m *TaskAddParameter) validateResourceFiles(formats strfmt.Registry) error {

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

    for i := 0; i < len(m.ResourceFiles); i++ {

        if swag.IsZero(m.ResourceFiles[i]) { // not required
            continue
        }

        if m.ResourceFiles[i] != nil {

            if err := m.ResourceFiles[i].Validate(formats); err != nil {
                return err
            }
        }

    }

    return nil
}