jkawamoto/roadie

View on GitHub
cloud/azure/compute/models/virtual_machine_list_result.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"
    "github.com/go-openapi/validate"
)

// VirtualMachineListResult The List Virtual Machine operation response.
// swagger:model VirtualMachineListResult
type VirtualMachineListResult struct {

    // The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next page of Virtual Machines.
    NextLink string `json:"nextLink,omitempty"`

    // The list of virtual machines.
    // Required: true
    Value []*VirtualMachine `json:"value"`
}

// Validate validates this virtual machine list result
func (m *VirtualMachineListResult) Validate(formats strfmt.Registry) error {
    var res []error

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

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

func (m *VirtualMachineListResult) validateValue(formats strfmt.Registry) error {

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

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

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

        if m.Value[i] != nil {

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

    }

    return nil
}