cloud/azure/batch/models/pool_update_properties_parameter.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"
"github.com/go-openapi/validate"
)
// PoolUpdatePropertiesParameter The set of changes to be made to a pool.
// swagger:model PoolUpdatePropertiesParameter
type PoolUpdatePropertiesParameter struct {
// A list of application packages to be installed on each compute node in the pool.
//
// Changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. The list replaces any existing application package references. If omitted, or if you specify an empty collection, any existing application packages references are removed from the pool.
// Required: true
ApplicationPackageReferences []*ApplicationPackageReference `json:"applicationPackageReferences"`
// A list of certificates to be installed on each compute node in the pool.
//
// If you specify an empty collection, any existing certificate references are removed from 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.
// Required: true
CertificateReferences []*CertificateReference `json:"certificateReferences"`
// A list of name-value pairs associated with the pool as metadata.
//
// This list replaces any existing metadata configured on the pool. If omitted, or if you specify an empty collection, any existing metadata is removed from the pool.
// Required: true
Metadata []*MetadataItem `json:"metadata"`
// A task 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.
//
// If this element is present, it overwrites any existing start task. If omitted, any existing start task is removed from the pool.
StartTask *StartTask `json:"startTask,omitempty"`
}
// Validate validates this pool update properties parameter
func (m *PoolUpdatePropertiesParameter) 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.validateMetadata(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateStartTask(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *PoolUpdatePropertiesParameter) validateApplicationPackageReferences(formats strfmt.Registry) error {
if err := validate.Required("applicationPackageReferences", "body", m.ApplicationPackageReferences); err != nil {
return err
}
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 *PoolUpdatePropertiesParameter) validateCertificateReferences(formats strfmt.Registry) error {
if err := validate.Required("certificateReferences", "body", m.CertificateReferences); err != nil {
return err
}
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 *PoolUpdatePropertiesParameter) validateMetadata(formats strfmt.Registry) error {
if err := validate.Required("metadata", "body", m.Metadata); err != nil {
return err
}
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 *PoolUpdatePropertiesParameter) 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
}