Class: NutanixVolumes::VolumesV40ConfigVolumeGroup

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb

Overview

A model that represents a Volume Group resource.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ VolumesV40ConfigVolumeGroup

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 167

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `NutanixVolumes::VolumesV40ConfigVolumeGroup` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `NutanixVolumes::VolumesV40ConfigVolumeGroup`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'tenant_id')
    self.tenant_id = attributes[:'tenant_id']
  end

  if attributes.key?(:'ext_id')
    self.ext_id = attributes[:'ext_id']
  end

  if attributes.key?(:'links')
    if (value = attributes[:'links']).is_a?(Array)
      self.links = value
    end
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'should_load_balance_vm_attachments')
    self.should_load_balance_vm_attachments = attributes[:'should_load_balance_vm_attachments']
  else
    self.should_load_balance_vm_attachments = false
  end

  if attributes.key?(:'sharing_status')
    self.sharing_status = attributes[:'sharing_status']
  end

  if attributes.key?(:'target_prefix')
    self.target_prefix = attributes[:'target_prefix']
  end

  if attributes.key?(:'target_name')
    self.target_name = attributes[:'target_name']
  end

  if attributes.key?(:'enabled_authentications')
    self.enabled_authentications = attributes[:'enabled_authentications']
  end

  if attributes.key?(:'iscsi_features')
    self.iscsi_features = attributes[:'iscsi_features']
  end

  if attributes.key?(:'created_by')
    self.created_by = attributes[:'created_by']
  end

  if attributes.key?(:'cluster_reference')
    self.cluster_reference = attributes[:'cluster_reference']
  end

  if attributes.key?(:'storage_features')
    self.storage_features = attributes[:'storage_features']
  end

  if attributes.key?(:'usage_type')
    self.usage_type = attributes[:'usage_type']
  end

  if attributes.key?(:'attachment_type')
    self.attachment_type = attributes[:'attachment_type']
  end

  if attributes.key?(:'protocol')
    self.protocol = attributes[:'protocol']
  end

  if attributes.key?(:'is_hidden')
    self.is_hidden = attributes[:'is_hidden']
  else
    self.is_hidden = false
  end

  if attributes.key?(:'disks')
    if (value = attributes[:'disks']).is_a?(Array)
      self.disks = value
    end
  end
end

Instance Attribute Details

#attachment_typeObject

Returns the value of attribute attachment_type.



59
60
61
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 59

def attachment_type
  @attachment_type
end

#cluster_referenceObject

The UUID of the cluster that will host the Volume Group. This is a mandatory field for creating a Volume Group on Prism Central.



53
54
55
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 53

def cluster_reference
  @cluster_reference
end

#created_byObject

Service/user who created this Volume Group. This is an optional field.



50
51
52
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 50

def created_by
  @created_by
end

#descriptionObject

Volume Group description. This is an optional field.



32
33
34
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 32

def description
  @description
end

#disksObject

A list of Volume Disks to be attached to the Volume Group.



67
68
69
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 67

def disks
  @disks
end

#enabled_authenticationsObject

Returns the value of attribute enabled_authentications.



45
46
47
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 45

def enabled_authentications
  @enabled_authentications
end

#ext_idObject

A globally unique identifier of an instance that is suitable for external consumption.



23
24
25
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 23

def ext_id
  @ext_id
end

#is_hiddenObject

Indicates whether the Volume Group is meant to be hidden or not. This is an optional field. If omitted, the VG will not be hidden.



64
65
66
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 64

def is_hidden
  @is_hidden
end

#iscsi_featuresObject

Returns the value of attribute iscsi_features.



47
48
49
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 47

def iscsi_features
  @iscsi_features
end

A HATEOAS style link for the response. Each link contains a user-friendly name identifying the link and an address for retrieving the particular resource.



26
27
28
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 26

def links
  @links
end

#nameObject

Volume Group name.



29
30
31
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 29

def name
  @name
end

#protocolObject

Returns the value of attribute protocol.



61
62
63
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 61

def protocol
  @protocol
end

#sharing_statusObject

Returns the value of attribute sharing_status.



37
38
39
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 37

def sharing_status
  @sharing_status
end

#should_load_balance_vm_attachmentsObject

Indicates whether to enable Volume Group load balancing for VM attachments. This cannot be enabled if there are iSCSI client attachments already associated with the Volume Group, and vice-versa. This is an optional field.



35
36
37
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 35

def should_load_balance_vm_attachments
  @should_load_balance_vm_attachments
end

#storage_featuresObject

Returns the value of attribute storage_features.



55
56
57
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 55

def storage_features
  @storage_features
end

#target_nameObject

Name of the external client target that will be visible and accessible to the client. This is an optional field.



43
44
45
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 43

def target_name
  @target_name
end

#target_prefixObject

The specifications contain the target prefix for external clients as the value. This is an optional field.



40
41
42
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 40

def target_prefix
  @target_prefix
end

#tenant_idObject

A globally unique identifier that represents the tenant that owns this entity. The system automatically assigns it, and it and is immutable from an API consumer perspective (some use cases may cause this Id to change - For instance, a use case may require the transfer of ownership of the entity, but these cases are handled automatically on the server).



20
21
22
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 20

def tenant_id
  @tenant_id
end

#usage_typeObject

Returns the value of attribute usage_type.



57
58
59
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 57

def usage_type
  @usage_type
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



117
118
119
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 117

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



122
123
124
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 122

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 92

def self.attribute_map
  {
    :'tenant_id' => :'tenantId',
    :'ext_id' => :'extId',
    :'links' => :'links',
    :'name' => :'name',
    :'description' => :'description',
    :'should_load_balance_vm_attachments' => :'shouldLoadBalanceVmAttachments',
    :'sharing_status' => :'sharingStatus',
    :'target_prefix' => :'targetPrefix',
    :'target_name' => :'targetName',
    :'enabled_authentications' => :'enabledAuthentications',
    :'iscsi_features' => :'iscsiFeatures',
    :'created_by' => :'createdBy',
    :'cluster_reference' => :'clusterReference',
    :'storage_features' => :'storageFeatures',
    :'usage_type' => :'usageType',
    :'attachment_type' => :'attachmentType',
    :'protocol' => :'protocol',
    :'is_hidden' => :'isHidden',
    :'disks' => :'disks'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 552

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



159
160
161
162
163
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 159

def self.openapi_all_of
  [
  :'CommonV10ResponseExternalizableAbstractModel'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



152
153
154
155
156
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 152

def self.openapi_nullable
  Set.new([
    :'ext_id',
  ])
end

.openapi_typesObject

Attribute type mapping.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 127

def self.openapi_types
  {
    :'tenant_id' => :'String',
    :'ext_id' => :'String',
    :'links' => :'Array<CommonV10ResponseApiLink>',
    :'name' => :'String',
    :'description' => :'String',
    :'should_load_balance_vm_attachments' => :'Boolean',
    :'sharing_status' => :'VolumesV40ConfigSharingStatus',
    :'target_prefix' => :'String',
    :'target_name' => :'String',
    :'enabled_authentications' => :'VolumesV40ConfigAuthenticationType',
    :'iscsi_features' => :'VolumesV40ConfigIscsiFeatures',
    :'created_by' => :'String',
    :'cluster_reference' => :'String',
    :'storage_features' => :'VolumesV40ConfigStorageFeatures',
    :'usage_type' => :'VolumesV40ConfigUsageType',
    :'attachment_type' => :'VolumesV40ConfigAttachmentType',
    :'protocol' => :'VolumesV40ConfigProtocol',
    :'is_hidden' => :'Boolean',
    :'disks' => :'Array<VolumesV40ConfigVolumeDisk>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 513

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      tenant_id == o.tenant_id &&
      ext_id == o.ext_id &&
      links == o.links &&
      name == o.name &&
      description == o.description &&
      should_load_balance_vm_attachments == o.should_load_balance_vm_attachments &&
      sharing_status == o.sharing_status &&
      target_prefix == o.target_prefix &&
      target_name == o.target_name &&
      enabled_authentications == o.enabled_authentications &&
      iscsi_features == o.iscsi_features &&
      created_by == o.created_by &&
      cluster_reference == o.cluster_reference &&
      storage_features == o.storage_features &&
      usage_type == o.usage_type &&
      attachment_type == o.attachment_type &&
      protocol == o.protocol &&
      is_hidden == o.is_hidden &&
      disks == o.disks
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


539
540
541
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 539

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



545
546
547
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 545

def hash
  [tenant_id, ext_id, links, name, description, should_load_balance_vm_attachments, sharing_status, target_prefix, target_name, enabled_authentications, iscsi_features, created_by, cluster_reference, storage_features, usage_type, attachment_type, protocol, is_hidden, disks].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 268

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if !@tenant_id.nil? && @tenant_id !~ pattern
    invalid_properties.push("invalid value for \"tenant_id\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if !@ext_id.nil? && @ext_id !~ pattern
    invalid_properties.push("invalid value for \"ext_id\", must conform to the pattern #{pattern}.")
  end

  if !@links.nil? && @links.length > 20
    invalid_properties.push('invalid value for "links", number of items must be less than or equal to 20.')
  end

  if !@links.nil? && @links.length < 0
    invalid_properties.push('invalid value for "links", number of items must be greater than or equal to 0.')
  end

  if !@name.nil? && @name.to_s.length > 256
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 256.')
  end

  if !@description.nil? && @description.to_s.length > 1000
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 1000.')
  end

  if !@target_prefix.nil? && @target_prefix.to_s.length > 512
    invalid_properties.push('invalid value for "target_prefix", the character length must be smaller than or equal to 512.')
  end

  pattern = Regexp.new(/^[\da-zA-Z:\.\-]+$/)
  if !@target_prefix.nil? && @target_prefix !~ pattern
    invalid_properties.push("invalid value for \"target_prefix\", must conform to the pattern #{pattern}.")
  end

  if !@target_name.nil? && @target_name.to_s.length > 512
    invalid_properties.push('invalid value for "target_name", the character length must be smaller than or equal to 512.')
  end

  if !@target_name.nil? && @target_name.to_s.length < 12
    invalid_properties.push('invalid value for "target_name", the character length must be greater than or equal to 12.')
  end

  if !@created_by.nil? && @created_by.to_s.length > 512
    invalid_properties.push('invalid value for "created_by", the character length must be smaller than or equal to 512.')
  end

  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if !@cluster_reference.nil? && @cluster_reference !~ pattern
    invalid_properties.push("invalid value for \"cluster_reference\", must conform to the pattern #{pattern}.")
  end

  if !@disks.nil? && @disks.length > 10
    invalid_properties.push('invalid value for "disks", number of items must be less than or equal to 10.')
  end

  if !@disks.nil? && @disks.length < 1
    invalid_properties.push('invalid value for "disks", number of items must be greater than or equal to 1.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 574

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/nutanix_volumes/models/volumes_v40_config_volume_group.rb', line 336

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@tenant_id.nil? && @tenant_id !~ Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  return false if !@ext_id.nil? && @ext_id !~ Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  return false if !@links.nil? && @links.length > 20
  return false if !@links.nil? && @links.length < 0
  return false if !@name.nil? && @name.to_s.length > 256
  return false if !@description.nil? && @description.to_s.length > 1000
  return false if !@target_prefix.nil? && @target_prefix.to_s.length > 512
  return false if !@target_prefix.nil? && @target_prefix !~ Regexp.new(/^[\da-zA-Z:\.\-]+$/)
  return false if !@target_name.nil? && @target_name.to_s.length > 512
  return false if !@target_name.nil? && @target_name.to_s.length < 12
  return false if !@created_by.nil? && @created_by.to_s.length > 512
  return false if !@cluster_reference.nil? && @cluster_reference !~ Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  return false if !@disks.nil? && @disks.length > 10
  return false if !@disks.nil? && @disks.length < 1
  true
end