jkawamoto/roadie

View on GitHub
cloud/azure/batch/models/resize_error.go

Summary

Maintainability
B
4 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"
)

// ResizeError An error that occurred when resizing a pool.
// swagger:model ResizeError
type ResizeError struct {

    // An identifier for the pool resize error. Codes are invariant and are intended to be consumed programmatically.
    Code string `json:"code,omitempty"`

    // A message describing the pool resize error, intended to be suitable for display in a user interface.
    Message string `json:"message,omitempty"`

    // A list of additional error details related to the pool resize error.
    Values []*NameValuePair `json:"values"`
}

// Validate validates this resize error
func (m *ResizeError) Validate(formats strfmt.Registry) error {
    var res []error

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

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

func (m *ResizeError) validateValues(formats strfmt.Registry) error {

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

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

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

        if m.Values[i] != nil {

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

    }

    return nil
}