Class: Azure::ARM::Compute::Models::DataDisk

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

Overview

Describes a data disk.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cachingCachingTypes

for this property include: ‘None’, ‘ReadOnly’, ‘ReadWrite’.

Returns:

  • (CachingTypes)

    Gets or sets the caching type. Possible values



36
37
38
# File 'lib/azure_mgmt_compute/models/data_disk.rb', line 36

def caching
  @caching
end

#create_optionDiskCreateOptionTypes

Possible values for this property include: ‘fromImage’, ‘empty’, ‘attach’.

Returns:



41
42
43
# File 'lib/azure_mgmt_compute/models/data_disk.rb', line 41

def create_option
  @create_option
end

#disk_size_gbInteger

disk to be created.

Returns:

  • (Integer)

    Gets or sets the disk size in GB for a blank data



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

def disk_size_gb
  @disk_size_gb
end

#imageVirtualHardDisk

VirtualHardDisk. This VirtualHardDisk will be copied before using it to attach to the Virtual Machine.If SourceImage is provided, the destination VirtualHardDisk should not exist.

Returns:



32
33
34
# File 'lib/azure_mgmt_compute/models/data_disk.rb', line 32

def image
  @image
end

#lunInteger

Returns Gets or sets the logical unit number.

Returns:

  • (Integer)

    Gets or sets the logical unit number.



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

def lun
  @lun
end

#nameString

Returns Gets or sets the disk name.

Returns:

  • (String)

    Gets or sets the disk name.



23
24
25
# File 'lib/azure_mgmt_compute/models/data_disk.rb', line 23

def name
  @name
end

#vhdVirtualHardDisk

Returns Gets or sets the Virtual Hard Disk.

Returns:



26
27
28
# File 'lib/azure_mgmt_compute/models/data_disk.rb', line 26

def vhd
  @vhd
end

Class Method Details

.deserialize_object(object) ⇒ DataDisk

Deserializes given Ruby Hash into Model object.

Parameters:

  • object (Hash)

    Ruby Hash object to deserialize.

Returns:



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/data_disk.rb', line 95

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

  deserialized_property = object['lun']
  deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty?
  output_object.lun = deserialized_property

  deserialized_property = object['diskSizeGB']
  deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty?
  output_object.disk_size_gb = deserialized_property

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

  deserialized_property = object['vhd']
  unless deserialized_property.nil?
    deserialized_property = VirtualHardDisk.deserialize_object(deserialized_property)
  end
  output_object.vhd = deserialized_property

  deserialized_property = object['image']
  unless deserialized_property.nil?
    deserialized_property = VirtualHardDisk.deserialize_object(deserialized_property)
  end
  output_object.image = deserialized_property

  deserialized_property = object['caching']
  if (!deserialized_property.nil? && !deserialized_property.empty?)
    enum_is_valid = CachingTypes.constants.any? { |e| CachingTypes.const_get(e).to_s.downcase == deserialized_property.downcase }
    fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
  end
  output_object.caching = deserialized_property

  deserialized_property = object['createOption']
  if (!deserialized_property.nil? && !deserialized_property.empty?)
    enum_is_valid = DiskCreateOptionTypes.constants.any? { |e| DiskCreateOptionTypes.const_get(e).to_s.downcase == deserialized_property.downcase }
    fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
  end
  output_object.create_option = 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.



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
86
87
88
# File 'lib/azure_mgmt_compute/models/data_disk.rb', line 56

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

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

  serialized_property = object.disk_size_gb
  output_object['diskSizeGB'] = serialized_property unless serialized_property.nil?

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

  serialized_property = object.vhd
  unless serialized_property.nil?
    serialized_property = VirtualHardDisk.serialize_object(serialized_property)
  end
  output_object['vhd'] = serialized_property unless serialized_property.nil?

  serialized_property = object.image
  unless serialized_property.nil?
    serialized_property = VirtualHardDisk.serialize_object(serialized_property)
  end
  output_object['image'] = serialized_property unless serialized_property.nil?

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

  serialized_property = object.create_option
  output_object['createOption'] = serialized_property unless serialized_property.nil?

  output_object
end

Instance Method Details

#validateObject

Validate the object. Throws ValidationError if validation fails.



46
47
48
49
# File 'lib/azure_mgmt_compute/models/data_disk.rb', line 46

def validate
  @vhd.validate unless @vhd.nil?
  @image.validate unless @image.nil?
end