jkawamoto/roadie

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

// SSHConfiguration SSH configuration for Linux based VMs running on Azure
// swagger:model SshConfiguration
type SSHConfiguration struct {

    // The list of SSH public keys used to authenticate with linux based VMs.
    PublicKeys []*SSHPublicKey `json:"publicKeys"`
}

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

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

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

func (m *SSHConfiguration) validatePublicKeys(formats strfmt.Registry) error {

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

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

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

        if m.PublicKeys[i] != nil {

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

    }

    return nil
}