Class: OCI::CloudBridge::Models::InstanceNetworkInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/cloud_bridge/models/instance_network_interface.rb

Overview

Describes a network interface.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InstanceNetworkInterface

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
214
215
216
217
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 136

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.association = attributes[:'association'] if attributes[:'association']

  self.attachment = attributes[:'attachment'] if attributes[:'attachment']

  self.description = attributes[:'description'] if attributes[:'description']

  self.security_groups = attributes[:'securityGroups'] if attributes[:'securityGroups']

  raise 'You cannot provide both :securityGroups and :security_groups' if attributes.key?(:'securityGroups') && attributes.key?(:'security_groups')

  self.security_groups = attributes[:'security_groups'] if attributes[:'security_groups']

  self.interface_type = attributes[:'interfaceType'] if attributes[:'interfaceType']

  raise 'You cannot provide both :interfaceType and :interface_type' if attributes.key?(:'interfaceType') && attributes.key?(:'interface_type')

  self.interface_type = attributes[:'interface_type'] if attributes[:'interface_type']

  self.ipv4_prefixes = attributes[:'ipv4Prefixes'] if attributes[:'ipv4Prefixes']

  raise 'You cannot provide both :ipv4Prefixes and :ipv4_prefixes' if attributes.key?(:'ipv4Prefixes') && attributes.key?(:'ipv4_prefixes')

  self.ipv4_prefixes = attributes[:'ipv4_prefixes'] if attributes[:'ipv4_prefixes']

  self.ipv6_addresses = attributes[:'ipv6Addresses'] if attributes[:'ipv6Addresses']

  raise 'You cannot provide both :ipv6Addresses and :ipv6_addresses' if attributes.key?(:'ipv6Addresses') && attributes.key?(:'ipv6_addresses')

  self.ipv6_addresses = attributes[:'ipv6_addresses'] if attributes[:'ipv6_addresses']

  self.ipv6_prefixes = attributes[:'ipv6Prefixes'] if attributes[:'ipv6Prefixes']

  raise 'You cannot provide both :ipv6Prefixes and :ipv6_prefixes' if attributes.key?(:'ipv6Prefixes') && attributes.key?(:'ipv6_prefixes')

  self.ipv6_prefixes = attributes[:'ipv6_prefixes'] if attributes[:'ipv6_prefixes']

  self.mac_address = attributes[:'macAddress'] if attributes[:'macAddress']

  raise 'You cannot provide both :macAddress and :mac_address' if attributes.key?(:'macAddress') && attributes.key?(:'mac_address')

  self.mac_address = attributes[:'mac_address'] if attributes[:'mac_address']

  self.network_interface_key = attributes[:'networkInterfaceKey'] if attributes[:'networkInterfaceKey']

  raise 'You cannot provide both :networkInterfaceKey and :network_interface_key' if attributes.key?(:'networkInterfaceKey') && attributes.key?(:'network_interface_key')

  self.network_interface_key = attributes[:'network_interface_key'] if attributes[:'network_interface_key']

  self.owner_key = attributes[:'ownerKey'] if attributes[:'ownerKey']

  raise 'You cannot provide both :ownerKey and :owner_key' if attributes.key?(:'ownerKey') && attributes.key?(:'owner_key')

  self.owner_key = attributes[:'owner_key'] if attributes[:'owner_key']

  self.private_ip_addresses = attributes[:'privateIpAddresses'] if attributes[:'privateIpAddresses']

  raise 'You cannot provide both :privateIpAddresses and :private_ip_addresses' if attributes.key?(:'privateIpAddresses') && attributes.key?(:'private_ip_addresses')

  self.private_ip_addresses = attributes[:'private_ip_addresses'] if attributes[:'private_ip_addresses']

  self.is_source_dest_check = attributes[:'isSourceDestCheck'] unless attributes[:'isSourceDestCheck'].nil?
  self.is_source_dest_check = false if is_source_dest_check.nil? && !attributes.key?(:'isSourceDestCheck') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isSourceDestCheck and :is_source_dest_check' if attributes.key?(:'isSourceDestCheck') && attributes.key?(:'is_source_dest_check')

  self.is_source_dest_check = attributes[:'is_source_dest_check'] unless attributes[:'is_source_dest_check'].nil?
  self.is_source_dest_check = false if is_source_dest_check.nil? && !attributes.key?(:'isSourceDestCheck') && !attributes.key?(:'is_source_dest_check') # rubocop:disable Style/StringLiterals

  self.status = attributes[:'status'] if attributes[:'status']

  self.subnet_key = attributes[:'subnetKey'] if attributes[:'subnetKey']

  raise 'You cannot provide both :subnetKey and :subnet_key' if attributes.key?(:'subnetKey') && attributes.key?(:'subnet_key')

  self.subnet_key = attributes[:'subnet_key'] if attributes[:'subnet_key']
end

Instance Attribute Details

#associationOCI::CloudBridge::Models::InstanceNetworkInterfaceAssociation



12
13
14
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 12

def association
  @association
end

#attachmentOCI::CloudBridge::Models::InstanceNetworkInterfaceAttachment



15
16
17
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 15

def attachment
  @attachment
end

#descriptionString

The description.

Returns:

  • (String)


19
20
21
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 19

def description
  @description
end

#interface_typeString

The type of network interface.

Returns:

  • (String)


27
28
29
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 27

def interface_type
  @interface_type
end

#ipv4_prefixesArray<String>

The IPv4 delegated prefixes that are assigned to the network interface.

Returns:

  • (Array<String>)


31
32
33
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 31

def ipv4_prefixes
  @ipv4_prefixes
end

#ipv6_addressesArray<String>

The IPv6 addresses associated with the network interface.

Returns:

  • (Array<String>)


35
36
37
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 35

def ipv6_addresses
  @ipv6_addresses
end

#ipv6_prefixesArray<String>

The IPv6 delegated prefixes that are assigned to the network interface.

Returns:

  • (Array<String>)


39
40
41
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 39

def ipv6_prefixes
  @ipv6_prefixes
end

#is_source_dest_checkBOOLEAN

Indicates whether source/destination checking is enabled.

Returns:

  • (BOOLEAN)


59
60
61
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 59

def is_source_dest_check
  @is_source_dest_check
end

#mac_addressString

The MAC address.

Returns:

  • (String)


43
44
45
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 43

def mac_address
  @mac_address
end

#network_interface_keyString

The ID of the network interface.

Returns:

  • (String)


47
48
49
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 47

def network_interface_key
  @network_interface_key
end

#owner_keyString

The ID of the AWS account that created the network interface.

Returns:

  • (String)


51
52
53
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 51

def owner_key
  @owner_key
end

#private_ip_addressesArray<OCI::CloudBridge::Models::InstancePrivateIpAddress>

The private IPv4 addresses associated with the network interface.



55
56
57
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 55

def private_ip_addresses
  @private_ip_addresses
end

#security_groupsArray<OCI::CloudBridge::Models::GroupIdentifier>

The security groups.



23
24
25
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 23

def security_groups
  @security_groups
end

#statusString

The status of the network interface.

Returns:

  • (String)


63
64
65
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 63

def status
  @status
end

#subnet_keyString

The ID of the subnet.

Returns:

  • (String)


67
68
69
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 67

def subnet_key
  @subnet_key
end

Class Method Details

.attribute_mapObject

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



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 70

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'association': :'association',
    'attachment': :'attachment',
    'description': :'description',
    'security_groups': :'securityGroups',
    'interface_type': :'interfaceType',
    'ipv4_prefixes': :'ipv4Prefixes',
    'ipv6_addresses': :'ipv6Addresses',
    'ipv6_prefixes': :'ipv6Prefixes',
    'mac_address': :'macAddress',
    'network_interface_key': :'networkInterfaceKey',
    'owner_key': :'ownerKey',
    'private_ip_addresses': :'privateIpAddresses',
    'is_source_dest_check': :'isSourceDestCheck',
    'status': :'status',
    'subnet_key': :'subnetKey'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'association': :'OCI::CloudBridge::Models::InstanceNetworkInterfaceAssociation',
    'attachment': :'OCI::CloudBridge::Models::InstanceNetworkInterfaceAttachment',
    'description': :'String',
    'security_groups': :'Array<OCI::CloudBridge::Models::GroupIdentifier>',
    'interface_type': :'String',
    'ipv4_prefixes': :'Array<String>',
    'ipv6_addresses': :'Array<String>',
    'ipv6_prefixes': :'Array<String>',
    'mac_address': :'String',
    'network_interface_key': :'String',
    'owner_key': :'String',
    'private_ip_addresses': :'Array<OCI::CloudBridge::Models::InstancePrivateIpAddress>',
    'is_source_dest_check': :'BOOLEAN',
    'status': :'String',
    'subnet_key': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 226

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    association == other.association &&
    attachment == other.attachment &&
    description == other.description &&
    security_groups == other.security_groups &&
    interface_type == other.interface_type &&
    ipv4_prefixes == other.ipv4_prefixes &&
    ipv6_addresses == other.ipv6_addresses &&
    ipv6_prefixes == other.ipv6_prefixes &&
    mac_address == other.mac_address &&
    network_interface_key == other.network_interface_key &&
    owner_key == other.owner_key &&
    private_ip_addresses == other.private_ip_addresses &&
    is_source_dest_check == other.is_source_dest_check &&
    status == other.status &&
    subnet_key == other.subnet_key
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



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 270

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


250
251
252
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 250

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



259
260
261
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 259

def hash
  [association, attachment, description, security_groups, interface_type, ipv4_prefixes, ipv6_addresses, ipv6_prefixes, mac_address, network_interface_key, owner_key, private_ip_addresses, is_source_dest_check, status, subnet_key].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



303
304
305
306
307
308
309
310
311
312
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 303

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



297
298
299
# File 'lib/oci/cloud_bridge/models/instance_network_interface.rb', line 297

def to_s
  to_hash.to_s
end