jkawamoto/roadie

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

// VirtualMachineProperties Describes the properties of a Virtual Machine.
// swagger:model VirtualMachineProperties
type VirtualMachineProperties struct {

    // The reference Id of the availability set to which the virtual machine belongs.
    AvailabilitySet *SubResource `json:"availabilitySet,omitempty"`

    // The diagnostics profile.
    DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"`

    // The hardware profile.
    HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"`

    // The virtual machine instance view.
    // Read Only: true
    InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"`

    // Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system.
    LicenseType string `json:"licenseType,omitempty"`

    // The network profile.
    NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"`

    // The OS profile.
    OsProfile *OSProfile `json:"osProfile,omitempty"`

    // The provisioning state, which only appears in the response.
    // Read Only: true
    ProvisioningState string `json:"provisioningState,omitempty"`

    // The storage profile.
    StorageProfile *StorageProfile `json:"storageProfile,omitempty"`

    // Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands.
    // Read Only: true
    VMID string `json:"vmId,omitempty"`
}

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

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

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

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

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

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

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

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

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

func (m *VirtualMachineProperties) validateAvailabilitySet(formats strfmt.Registry) error {

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

    if m.AvailabilitySet != nil {

        if err := m.AvailabilitySet.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}

func (m *VirtualMachineProperties) validateDiagnosticsProfile(formats strfmt.Registry) error {

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

    if m.DiagnosticsProfile != nil {

        if err := m.DiagnosticsProfile.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}

func (m *VirtualMachineProperties) validateHardwareProfile(formats strfmt.Registry) error {

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

    if m.HardwareProfile != nil {

        if err := m.HardwareProfile.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}

func (m *VirtualMachineProperties) validateInstanceView(formats strfmt.Registry) error {

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

    if m.InstanceView != nil {

        if err := m.InstanceView.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}

func (m *VirtualMachineProperties) validateNetworkProfile(formats strfmt.Registry) error {

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

    if m.NetworkProfile != nil {

        if err := m.NetworkProfile.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}

func (m *VirtualMachineProperties) validateOsProfile(formats strfmt.Registry) error {

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

    if m.OsProfile != nil {

        if err := m.OsProfile.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}

func (m *VirtualMachineProperties) validateStorageProfile(formats strfmt.Registry) error {

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

    if m.StorageProfile != nil {

        if err := m.StorageProfile.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}