Class: Azure::ARM::Compute::Models::StorageProfile

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

Overview

Describes a storage profile.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#data_disksArray<DataDisk>

Returns Gets or sets the data disks.

Returns:

  • (Array<DataDisk>)

    Gets or sets the data disks.



22
23
24
# File 'lib/azure_mgmt_compute/models/storage_profile.rb', line 22

def data_disks
  @data_disks
end

#image_referenceImageReference

Returns Gets or sets the image reference.

Returns:



16
17
18
# File 'lib/azure_mgmt_compute/models/storage_profile.rb', line 16

def image_reference
  @image_reference
end

#os_diskOSDisk

Returns Gets or sets the OS disk.

Returns:

  • (OSDisk)

    Gets or sets the OS disk.



19
20
21
# File 'lib/azure_mgmt_compute/models/storage_profile.rb', line 19

def os_disk
  @os_disk
end

Class Method Details

.deserialize_object(object) ⇒ StorageProfile

Deserializes given Ruby Hash into Model object.

Parameters:

  • object (Hash)

    Ruby Hash object to deserialize.

Returns:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/azure_mgmt_compute/models/storage_profile.rb', line 75

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

  deserialized_property = object['imageReference']
  unless deserialized_property.nil?
    deserialized_property = ImageReference.deserialize_object(deserialized_property)
  end
  output_object.image_reference = deserialized_property

  deserialized_property = object['osDisk']
  unless deserialized_property.nil?
    deserialized_property = OSDisk.deserialize_object(deserialized_property)
  end
  output_object.os_disk = deserialized_property

  deserialized_property = object['dataDisks']
  unless deserialized_property.nil?
    deserializedArray = [];
    deserialized_property.each do |element1|
      unless element1.nil?
        element1 = DataDisk.deserialize_object(element1)
      end
      deserializedArray.push(element1);
    end
    deserialized_property = deserializedArray;
  end
  output_object.data_disks = 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.



38
39
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
# File 'lib/azure_mgmt_compute/models/storage_profile.rb', line 38

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

  serialized_property = object.image_reference
  unless serialized_property.nil?
    serialized_property = ImageReference.serialize_object(serialized_property)
  end
  output_object['imageReference'] = serialized_property unless serialized_property.nil?

  serialized_property = object.os_disk
  unless serialized_property.nil?
    serialized_property = OSDisk.serialize_object(serialized_property)
  end
  output_object['osDisk'] = serialized_property unless serialized_property.nil?

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

  output_object
end

Instance Method Details

#validateObject

Validate the object. Throws ValidationError if validation fails.



27
28
29
30
31
# File 'lib/azure_mgmt_compute/models/storage_profile.rb', line 27

def validate
  @image_reference.validate unless @image_reference.nil?
  @os_disk.validate unless @os_disk.nil?
  @data_disks.each{ |e| e.validate if e.respond_to?(:validate) } unless @data_disks.nil?
end