Class: NutanixClustermgmt::ClustermgmtV40ConfigVirtualGpuConfig

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb

Overview

Virtual GPU configuration details.

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 = {}) ⇒ ClustermgmtV40ConfigVirtualGpuConfig

Initializes the object



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
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
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 145

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `NutanixClustermgmt::ClustermgmtV40ConfigVirtualGpuConfig` 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 `NutanixClustermgmt::ClustermgmtV40ConfigVirtualGpuConfig`. 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?(:'type')
    self.type = attributes[:'type']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#assignableObject

GPU assignable.



40
41
42
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 40

def assignable
  @assignable
end

#device_idObject

Device Id.



22
23
24
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 22

def device_id
  @device_id
end

#device_nameObject

Device name.



25
26
27
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 25

def device_name
  @device_name
end

#fractionObject

GPU fraction.



43
44
45
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 43

def fraction
  @fraction
end

#frame_buffer_size_bytesObject

Frame buffer size in bytes.



55
56
57
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 55

def frame_buffer_size_bytes
  @frame_buffer_size_bytes
end

#guest_driver_versionObject

Guest driver version.



46
47
48
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 46

def guest_driver_version
  @guest_driver_version
end

#is_in_useObject

GPU in use.



31
32
33
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 31

def is_in_use
  @is_in_use
end

#licensesObject

GPU license list.



49
50
51
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 49

def licenses
  @licenses
end

#max_instances_per_vmObject

Maximum instances allowed per VM.



61
62
63
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 61

def max_instances_per_vm
  @max_instances_per_vm
end

#max_resolutionObject

Maximum resolution per display heads.



58
59
60
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 58

def max_resolution
  @max_resolution
end

#numa_nodeObject

NUMA node.



37
38
39
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 37

def numa_node
  @numa_node
end

#number_of_virtual_display_headsObject

Number of virtual display heads.



52
53
54
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 52

def number_of_virtual_display_heads
  @number_of_virtual_display_heads
end

#sbdfObject

SBDF address.



34
35
36
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 34

def sbdf
  @sbdf
end

#typeObject

Returns the value of attribute type.



19
20
21
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 19

def type
  @type
end

#vendor_nameObject

Vendor name.



28
29
30
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 28

def vendor_name
  @vendor_name
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



107
108
109
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 107

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



112
113
114
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 112

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 86

def self.attribute_map
  {
    :'type' => :'type',
    :'device_id' => :'deviceId',
    :'device_name' => :'deviceName',
    :'vendor_name' => :'vendorName',
    :'is_in_use' => :'isInUse',
    :'sbdf' => :'sbdf',
    :'numa_node' => :'numaNode',
    :'assignable' => :'assignable',
    :'fraction' => :'fraction',
    :'guest_driver_version' => :'guestDriverVersion',
    :'licenses' => :'licenses',
    :'number_of_virtual_display_heads' => :'numberOfVirtualDisplayHeads',
    :'frame_buffer_size_bytes' => :'frameBufferSizeBytes',
    :'max_resolution' => :'maxResolution',
    :'max_instances_per_vm' => :'maxInstancesPerVm'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 358

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_nullableObject

List of attributes with nullable: true



138
139
140
141
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 138

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 117

def self.openapi_types
  {
    :'type' => :'ClustermgmtV40ConfigGpuType',
    :'device_id' => :'Integer',
    :'device_name' => :'String',
    :'vendor_name' => :'String',
    :'is_in_use' => :'Boolean',
    :'sbdf' => :'String',
    :'numa_node' => :'String',
    :'assignable' => :'Integer',
    :'fraction' => :'Integer',
    :'guest_driver_version' => :'String',
    :'licenses' => :'Array<String>',
    :'number_of_virtual_display_heads' => :'Integer',
    :'frame_buffer_size_bytes' => :'Integer',
    :'max_resolution' => :'String',
    :'max_instances_per_vm' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 323

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      type == o.type &&
      device_id == o.device_id &&
      device_name == o.device_name &&
      vendor_name == o.vendor_name &&
      is_in_use == o.is_in_use &&
      sbdf == o.sbdf &&
      numa_node == o.numa_node &&
      assignable == o.assignable &&
      fraction == o.fraction &&
      guest_driver_version == o.guest_driver_version &&
      licenses == o.licenses &&
      number_of_virtual_display_heads == o.number_of_virtual_display_heads &&
      frame_buffer_size_bytes == o.frame_buffer_size_bytes &&
      max_resolution == o.max_resolution &&
      max_instances_per_vm == o.max_instances_per_vm
end

#eql?(o) ⇒ Boolean

See Also:

  • `==` method


345
346
347
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 345

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.



351
352
353
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 351

def hash
  [type, device_id, device_name, vendor_name, is_in_use, sbdf, numa_node, assignable, fraction, guest_driver_version, licenses, number_of_virtual_display_heads, frame_buffer_size_bytes, max_resolution, max_instances_per_vm].hash
end

#list_invalid_propertiesObject

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



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
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 224

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@vendor_name.nil? && @vendor_name.to_s.length > 128
    invalid_properties.push('invalid value for "vendor_name", the character length must be smaller than or equal to 128.')
  end

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

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash



380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 380

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



256
257
258
259
260
261
262
263
264
265
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_gpu_config.rb', line 256

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@vendor_name.nil? && @vendor_name.to_s.length > 128
  return false if !@vendor_name.nil? && @vendor_name.to_s.length < 0
  return false if !@licenses.nil? && @licenses.length > 1024
  return false if !@licenses.nil? && @licenses.length < 0
  return false if !@max_resolution.nil? && @max_resolution.to_s.length > 16
  return false if !@max_resolution.nil? && @max_resolution.to_s.length < 0
  true
end