Class: NutanixClustermgmt::ClustermgmtV40ConfigVirtualNic

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

Overview

Virtual NIC details.

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

Initializes the object



132
133
134
135
136
137
138
139
140
141
142
143
144
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
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 132

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#ext_idObject

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



23
24
25
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 23

def ext_id
  @ext_id
end

#host_descriptionObject

Host description.



32
33
34
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 32

def host_description
  @host_description
end

#host_nics_uuidsObject

List of host NIC UUID associated with the host virtual NIC.



62
63
64
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 62

def host_nics_uuids
  @host_nics_uuids
end

#interface_statusObject

Operational status of the interface to the port associated with the NIC entity.



44
45
46
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 44

def interface_status
  @interface_status
end

#ipv4_addressesObject

List of IPv4 addresses associated with the NIC entity for the network connection.



38
39
40
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 38

def ipv4_addresses
  @ipv4_addresses
end

#ipv6_addressesObject

List of IPv6 addresses associated with the NIC entity for the network connection.



41
42
43
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 41

def ipv6_addresses
  @ipv6_addresses
end

#is_dhcp_enabledObject

Status of DHCP protocol.



47
48
49
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 47

def is_dhcp_enabled
  @is_dhcp_enabled
end

Link speed in Kbps.



50
51
52
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 50

def link_speed_in_kbps
  @link_speed_in_kbps
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_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 26

def links
  @links
end

#mac_addressObject

Host Mac address.



35
36
37
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 35

def mac_address
  @mac_address
end

#mtu_in_bytesObject

Maximum transmission unit in bytes.



53
54
55
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 53

def mtu_in_bytes
  @mtu_in_bytes
end

#nameObject

Virtual NIC name.



29
30
31
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 29

def name
  @name
end

#node_uuidObject

UUID of the host.



56
57
58
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 56

def node_uuid
  @node_uuid
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_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 20

def tenant_id
  @tenant_id
end

#vlan_idObject

VLAN Id.



59
60
61
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 59

def vlan_id
  @vlan_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



86
87
88
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 86

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



91
92
93
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 91

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 65

def self.attribute_map
  {
    :'tenant_id' => :'tenantId',
    :'ext_id' => :'extId',
    :'links' => :'links',
    :'name' => :'name',
    :'host_description' => :'hostDescription',
    :'mac_address' => :'macAddress',
    :'ipv4_addresses' => :'ipv4Addresses',
    :'ipv6_addresses' => :'ipv6Addresses',
    :'interface_status' => :'interfaceStatus',
    :'is_dhcp_enabled' => :'isDhcpEnabled',
    :'link_speed_in_kbps' => :'linkSpeedInKbps',
    :'mtu_in_bytes' => :'mtuInBytes',
    :'node_uuid' => :'nodeUuid',
    :'vlan_id' => :'vlanId',
    :'host_nics_uuids' => :'hostNicsUuids'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 478

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)



124
125
126
127
128
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 124

def self.openapi_all_of
  [
  :'CommonV10ResponseExternalizableAbstractModel'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



117
118
119
120
121
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 117

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

.openapi_typesObject

Attribute type mapping.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 96

def self.openapi_types
  {
    :'tenant_id' => :'String',
    :'ext_id' => :'String',
    :'links' => :'Array<CommonV10ResponseApiLink>',
    :'name' => :'String',
    :'host_description' => :'String',
    :'mac_address' => :'String',
    :'ipv4_addresses' => :'Array<CommonV10ConfigIPAddress>',
    :'ipv6_addresses' => :'Array<CommonV10ConfigIPAddress>',
    :'interface_status' => :'String',
    :'is_dhcp_enabled' => :'Boolean',
    :'link_speed_in_kbps' => :'Integer',
    :'mtu_in_bytes' => :'Integer',
    :'node_uuid' => :'String',
    :'vlan_id' => :'Integer',
    :'host_nics_uuids' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 443

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 &&
      host_description == o.host_description &&
      mac_address == o.mac_address &&
      ipv4_addresses == o.ipv4_addresses &&
      ipv6_addresses == o.ipv6_addresses &&
      interface_status == o.interface_status &&
      is_dhcp_enabled == o.is_dhcp_enabled &&
      link_speed_in_kbps == o.link_speed_in_kbps &&
      mtu_in_bytes == o.mtu_in_bytes &&
      node_uuid == o.node_uuid &&
      vlan_id == o.vlan_id &&
      host_nics_uuids == o.host_nics_uuids
end

#eql?(o) ⇒ Boolean

See Also:

  • `==` method


465
466
467
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 465

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.



471
472
473
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 471

def hash
  [tenant_id, ext_id, links, name, host_description, mac_address, ipv4_addresses, ipv6_addresses, interface_status, is_dhcp_enabled, link_speed_in_kbps, mtu_in_bytes, node_uuid, vlan_id, host_nics_uuids].hash
end

#list_invalid_propertiesObject

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



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
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 217

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 > 64
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 64.')
  end

  pattern = Regexp.new(/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/)
  if !@mac_address.nil? && @mac_address !~ pattern
    invalid_properties.push("invalid value for \"mac_address\", must conform to the pattern #{pattern}.")
  end

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

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

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

  if !@ipv6_addresses.nil? && @ipv6_addresses.length < 0
    invalid_properties.push('invalid value for "ipv6_addresses", number of items must be greater than or equal to 0.')
  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 !@node_uuid.nil? && @node_uuid !~ pattern
    invalid_properties.push("invalid value for \"node_uuid\", must conform to the pattern #{pattern}.")
  end

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash



500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 500

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



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/nutanix_clustermgmt/models/clustermgmt_v40_config_virtual_nic.rb', line 281

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 > 64
  return false if !@mac_address.nil? && @mac_address !~ Regexp.new(/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/)
  return false if !@ipv4_addresses.nil? && @ipv4_addresses.length > 1024
  return false if !@ipv4_addresses.nil? && @ipv4_addresses.length < 0
  return false if !@ipv6_addresses.nil? && @ipv6_addresses.length > 1024
  return false if !@ipv6_addresses.nil? && @ipv6_addresses.length < 0
  return false if !@node_uuid.nil? && @node_uuid !~ 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 !@host_nics_uuids.nil? && @host_nics_uuids.length > 1024
  return false if !@host_nics_uuids.nil? && @host_nics_uuids.length < 0
  true
end