jkawamoto/roadie

View on GitHub
cloud/azure/compute/models/win_r_m_configuration.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"
)

// WinRMConfiguration Describes Windows Remote Management configuration of the VM
// swagger:model WinRMConfiguration
type WinRMConfiguration struct {

    // The list of Windows Remote Management listeners
    Listeners []*WinRMListener `json:"listeners"`
}

// Validate validates this win r m configuration
func (m *WinRMConfiguration) Validate(formats strfmt.Registry) error {
    var res []error

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

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

func (m *WinRMConfiguration) validateListeners(formats strfmt.Registry) error {

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

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

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

        if m.Listeners[i] != nil {

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

    }

    return nil
}