Class: Azure::ARM::Compute::Models::VirtualMachine

Inherits:
MsRestAzure::Resource
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/azure_mgmt_compute/models/virtual_machine.rb

Overview

Describes a Virtual Machine.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#planPlan

machine from VM Marketplace images.

Returns:

  • (Plan)

    Gets or sets the purchase plan when deploying virtual



17
18
19
# File 'lib/azure_mgmt_compute/models/virtual_machine.rb', line 17

def plan
  @plan
end

#propertiesVirtualMachineProperties



20
21
22
# File 'lib/azure_mgmt_compute/models/virtual_machine.rb', line 20

def properties
  @properties
end

#resourcesArray<VirtualMachineExtension>

child extension resources.

Returns:



24
25
26
# File 'lib/azure_mgmt_compute/models/virtual_machine.rb', line 24

def resources
  @resources
end

Class Method Details

.deserialize_object(object) ⇒ VirtualMachine

Deserializes given Ruby Hash into Model object.

Parameters:

  • object (Hash)

    Ruby Hash object to deserialize.

Returns:



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/azure_mgmt_compute/models/virtual_machine.rb', line 92

def self.deserialize_object(object)
  return if object.nil?
  output_object = VirtualMachine.new

  deserialized_property = object['location']
  output_object.location = deserialized_property

  deserialized_property = object['id']
  output_object.id = deserialized_property

  deserialized_property = object['name']
  output_object.name = deserialized_property

  deserialized_property = object['type']
  output_object.type = deserialized_property

  deserialized_property = object['tags']
  output_object.tags = deserialized_property

  deserialized_property = object['plan']
  unless deserialized_property.nil?
    deserialized_property = Plan.deserialize_object(deserialized_property)
  end
  output_object.plan = deserialized_property

  deserialized_property = object['properties']
  unless deserialized_property.nil?
    deserialized_property = VirtualMachineProperties.deserialize_object(deserialized_property)
  end
  output_object.properties = deserialized_property

  deserialized_property = object['resources']
  unless deserialized_property.nil?
    deserializedArray = [];
    deserialized_property.each do |element1|
      unless element1.nil?
        element1 = VirtualMachineExtension.deserialize_object(element1)
      end
      deserializedArray.push(element1);
    end
    deserialized_property = deserializedArray;
  end
  output_object.resources = deserialized_property

  output_object.validate

  output_object
end

.serialize_object(object) ⇒ Hash

Serializes given Model object into Ruby Hash.

Parameters:

  • object

    Model object to serialize.

Returns:

  • (Hash)

    Serialized object in form of Ruby Hash.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/azure_mgmt_compute/models/virtual_machine.rb', line 40

def self.serialize_object(object)
  object.validate
  output_object = {}

  serialized_property = object.location
  output_object['location'] = serialized_property unless serialized_property.nil?

  serialized_property = object.id
  output_object['id'] = serialized_property unless serialized_property.nil?

  serialized_property = object.name
  output_object['name'] = serialized_property unless serialized_property.nil?

  serialized_property = object.type
  output_object['type'] = serialized_property unless serialized_property.nil?

  serialized_property = object.tags
  output_object['tags'] = serialized_property unless serialized_property.nil?

  serialized_property = object.plan
  unless serialized_property.nil?
    serialized_property = Plan.serialize_object(serialized_property)
  end
  output_object['plan'] = serialized_property unless serialized_property.nil?

  serialized_property = object.properties
  unless serialized_property.nil?
    serialized_property = VirtualMachineProperties.serialize_object(serialized_property)
  end
  output_object['properties'] = serialized_property unless serialized_property.nil?

  serialized_property = object.resources
  unless serialized_property.nil?
    serializedArray = []
    serialized_property.each do |element|
      unless element.nil?
        element = VirtualMachineExtension.serialize_object(element)
      end
      serializedArray.push(element)
    end
    serialized_property = serializedArray
  end
  output_object['resources'] = serialized_property unless serialized_property.nil?

  output_object
end

Instance Method Details

#validateObject

Validate the object. Throws ValidationError if validation fails.



29
30
31
32
33
# File 'lib/azure_mgmt_compute/models/virtual_machine.rb', line 29

def validate
  @plan.validate unless @plan.nil?
  @properties.validate unless @properties.nil?
  @resources.each{ |e| e.validate if e.respond_to?(:validate) } unless @resources.nil?
end