jkawamoto/roadie

View on GitHub
cloud/azure/resource/models/deployment_extended.go

Summary

Maintainability
A
1 hr
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/errors"
    "github.com/go-openapi/swag"
    "github.com/go-openapi/validate"
)

// DeploymentExtended Deployment information.
// swagger:model DeploymentExtended
type DeploymentExtended struct {

    // The ID of the deployment.
    ID string `json:"id,omitempty"`

    // The name of the deployment.
    // Required: true
    Name *string `json:"name"`

    // Deployment properties.
    Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
}

// Validate validates this deployment extended
func (m *DeploymentExtended) Validate(formats strfmt.Registry) error {
    var res []error

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

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

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

func (m *DeploymentExtended) validateName(formats strfmt.Registry) error {

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

    return nil
}

func (m *DeploymentExtended) validateProperties(formats strfmt.Registry) error {

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

    if m.Properties != nil {

        if err := m.Properties.Validate(formats); err != nil {
            if ve, ok := err.(*errors.Validation); ok {
                return ve.ValidateName("properties")
            }
            return err
        }
    }

    return nil
}