jkawamoto/roadie

View on GitHub
cloud/azure/batch/models/pool_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"
)

// PoolAddParameter A pool in the Azure Batch service to add.
// swagger:model PoolAddParameter
type PoolAddParameter struct {

    // The list of application packages to be installed on each compute node in the pool.
    //
    // This property is currently not supported on pools created using the virtualMachineConfiguration (IaaS) property.
    ApplicationPackageReferences []*ApplicationPackageReference `json:"applicationPackageReferences"`

    // The time interval at which to automatically adjust the pool size according to the autoscale formula.
    //
    // The default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request).
    AutoScaleEvaluationInterval strfmt.Duration `json:"autoScaleEvaluationInterval,omitempty"`

    // A formula for the desired number of compute nodes in the pool.
    //
    // This property must not be specified if enableAutoScale is set to false. It is required if enableAutoScale is set to true. The formula is checked for validity before the pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see 'Automatically scale compute nodes in an Azure Batch pool' (https://azure.microsoft.com/documentation/articles/batch-automatic-scaling/).
    AutoScaleFormula string `json:"autoScaleFormula,omitempty"`

    // The list of certificates to be installed on each compute node in the pool.
    //
    // For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of remoteuser, a certs directory is created in the user's home directory (e.g., /home/<user-name>/certs) where certificates are placed.
    CertificateReferences []*CertificateReference `json:"certificateReferences"`

    // The cloud service configuration for the pool.
    //
    // This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified.
    CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"`

    // The display name for the pool.
    //
    // 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"`

    // Whether the pool size should automatically adjust over time.
    //
    // If true, the autoScaleFormula property must be set. If false, the targetDedicated property must be set. The default value is false.
    EnableAutoScale bool `json:"enableAutoScale,omitempty"`

    // Whether the pool permits direct communication between nodes.
    //
    // Enabling inter-node communication limits the maximum size of the pool due to deployment restrictions on the nodes of the pool. This may result in the pool not reaching its desired size. The default value is false.
    EnableInterNodeCommunication bool `json:"enableInterNodeCommunication,omitempty"`

    // A string that uniquely identifies the pool within the account.
    //
    // 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 pool IDs within an account that differ only by case).
    // Required: true
    ID *string `json:"id"`

    // The maximum number of tasks that can run concurrently on a single compute node in the pool.
    //
    // The default value is 1. The maximum value of this setting depends on the size of the compute nodes in the pool (the vmSize setting).
    MaxTasksPerNode int32 `json:"maxTasksPerNode,omitempty"`

    // A list of name-value pairs associated with the pool as metadata.
    //
    // The Batch service does not assign any meaning to metadata; it is solely for the use of user code.
    Metadata []*MetadataItem `json:"metadata"`

    // The network configuration for the pool.
    NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"`

    // The timeout for allocation of compute nodes to the pool.
    //
    // This timeout applies only to manual scaling; it has no effect when enableAutoScale is set to true. The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request).
    ResizeTimeout strfmt.Duration `json:"resizeTimeout,omitempty"`

    // A task specified to run on each compute node as it joins the pool.
    //
    // The task runs when the node is added to the pool or when the node is restarted.
    StartTask *StartTask `json:"startTask,omitempty"`

    // The desired number of compute nodes in the pool.
    //
    // This property must have the default value if enableAutoScale is true. It is required if enableAutoScale is false.
    TargetDedicated int32 `json:"targetDedicated,omitempty"`

    // How the Batch service distributes tasks between compute nodes in the pool.
    TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"`

    // The virtual machine configuration for the pool.
    //
    // This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified.
    VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"`

    // The size of virtual machines in the pool. All virtual machines in a pool are the same size.
    //
    // For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).
    // Required: true
    VMSize *string `json:"vmSize"`
}

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

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

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

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

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

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

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

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

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

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

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

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

func (m *PoolAddParameter) 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 *PoolAddParameter) validateCertificateReferences(formats strfmt.Registry) error {

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

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

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

        if m.CertificateReferences[i] != nil {

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

    }

    return nil
}

func (m *PoolAddParameter) validateCloudServiceConfiguration(formats strfmt.Registry) error {

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

    if m.CloudServiceConfiguration != nil {

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

    return nil
}

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

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

    return nil
}

func (m *PoolAddParameter) validateMetadata(formats strfmt.Registry) error {

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

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

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

        if m.Metadata[i] != nil {

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

    }

    return nil
}

func (m *PoolAddParameter) validateNetworkConfiguration(formats strfmt.Registry) error {

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

    if m.NetworkConfiguration != nil {

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

    return nil
}

func (m *PoolAddParameter) validateStartTask(formats strfmt.Registry) error {

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

    if m.StartTask != nil {

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

    return nil
}

func (m *PoolAddParameter) validateTaskSchedulingPolicy(formats strfmt.Registry) error {

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

    if m.TaskSchedulingPolicy != nil {

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

    return nil
}

func (m *PoolAddParameter) validateVirtualMachineConfiguration(formats strfmt.Registry) error {

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

    if m.VirtualMachineConfiguration != nil {

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

    return nil
}

func (m *PoolAddParameter) validateVMSize(formats strfmt.Registry) error {

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

    return nil
}