cloud/azure/batch/models/job_schedule_add_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"
)
// JobScheduleAddParameter A job schedule that allows recurring jobs by specifying when to run jobs and a specification used to create each job.
// swagger:model JobScheduleAddParameter
type JobScheduleAddParameter struct {
// The display name for the schedule.
//
// 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 string that uniquely identifies the schedule 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 ids within an account that differ only by case).
// Required: true
ID *string `json:"id"`
// The details of the jobs to be created on this schedule.
// Required: true
JobSpecification *JobSpecification `json:"jobSpecification"`
// A list of name-value pairs associated with the schedule 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 schedule according to which jobs will be created.
// Required: true
Schedule *Schedule `json:"schedule"`
}
// Validate validates this job schedule add parameter
func (m *JobScheduleAddParameter) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateID(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateJobSpecification(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateMetadata(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateSchedule(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *JobScheduleAddParameter) validateID(formats strfmt.Registry) error {
if err := validate.Required("id", "body", m.ID); err != nil {
return err
}
return nil
}
func (m *JobScheduleAddParameter) validateJobSpecification(formats strfmt.Registry) error {
if err := validate.Required("jobSpecification", "body", m.JobSpecification); err != nil {
return err
}
if m.JobSpecification != nil {
if err := m.JobSpecification.Validate(formats); err != nil {
return err
}
}
return nil
}
func (m *JobScheduleAddParameter) 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 *JobScheduleAddParameter) validateSchedule(formats strfmt.Registry) error {
if err := validate.Required("schedule", "body", m.Schedule); err != nil {
return err
}
if m.Schedule != nil {
if err := m.Schedule.Validate(formats); err != nil {
return err
}
}
return nil
}