jkawamoto/roadie

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

Summary

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

// DeploymentValidateResult Information from validate template deployment response.
// swagger:model DeploymentValidateResult
type DeploymentValidateResult struct {

    // Validation error.
    Error *ResourceManagementErrorWithDetails `json:"error,omitempty"`

    // The template deployment properties.
    Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
}

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

    if err := m.validateError(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 *DeploymentValidateResult) validateError(formats strfmt.Registry) error {

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

    if m.Error != nil {

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

    return nil
}

func (m *DeploymentValidateResult) 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
}