Class: OCI::Mngdmac::Models::MacDevice

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/mngdmac/models/mac_device.rb

Overview

Represents a MacDevice resource.

Constant Summary collapse

LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_NEEDS_ATTENTION = 'NEEDS_ATTENTION'.freeze,
  LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MacDevice

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :id (String)

    The value to assign to the #id property

  • :compartment_id (String)

    The value to assign to the #compartment_id property

  • :mac_order_id (String)

    The value to assign to the #mac_order_id property

  • :serial_number (String)

    The value to assign to the #serial_number property

  • :ip_address (String)

    The value to assign to the #ip_address property

  • :lifecycle_state (String)

    The value to assign to the #lifecycle_state property

  • :shape (String)

    The value to assign to the #shape property

  • :time_created (DateTime)

    The value to assign to the #time_created property

  • :time_updated (DateTime)

    The value to assign to the #time_updated property

  • :is_marked_decom (BOOLEAN)

    The value to assign to the #is_marked_decom property

  • :time_decom (DateTime)

    The value to assign to the #time_decom property



121
122
123
124
125
126
127
128
129
130
131
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
# File 'lib/oci/mngdmac/models/mac_device.rb', line 121

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.id = attributes[:'id'] if attributes[:'id']

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

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

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

  self.mac_order_id = attributes[:'macOrderId'] if attributes[:'macOrderId']

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

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

  self.serial_number = attributes[:'serialNumber'] if attributes[:'serialNumber']

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

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

  self.ip_address = attributes[:'ipAddress'] if attributes[:'ipAddress']

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

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

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

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

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

  self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']

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

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

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

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

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

  self.time_decom = attributes[:'timeDecom'] if attributes[:'timeDecom']

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

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

Instance Attribute Details

#compartment_idString

[Required] OCID of the compartment to which the resource belongs to.

Returns:

  • (String)


28
29
30
# File 'lib/oci/mngdmac/models/mac_device.rb', line 28

def compartment_id
  @compartment_id
end

#idString

[Required] The unique ID of the MacDevice.

Returns:

  • (String)


24
25
26
# File 'lib/oci/mngdmac/models/mac_device.rb', line 24

def id
  @id
end

#ip_addressString

[Required] The IP address assigned to the MacDevice.

Returns:

  • (String)


40
41
42
# File 'lib/oci/mngdmac/models/mac_device.rb', line 40

def ip_address
  @ip_address
end

#is_marked_decomBOOLEAN

[Required] A flag that indicates if this MacDevice is decommissioned.

Returns:

  • (BOOLEAN)


60
61
62
# File 'lib/oci/mngdmac/models/mac_device.rb', line 60

def is_marked_decom
  @is_marked_decom
end

#lifecycle_stateString

[Required] The current status of the MacDevice.

Returns:

  • (String)


44
45
46
# File 'lib/oci/mngdmac/models/mac_device.rb', line 44

def lifecycle_state
  @lifecycle_state
end

#mac_order_idString

[Required] The OCID of the resource.

Returns:

  • (String)


32
33
34
# File 'lib/oci/mngdmac/models/mac_device.rb', line 32

def mac_order_id
  @mac_order_id
end

#serial_numberString

[Required] The serial number of the MacDevice.

Returns:

  • (String)


36
37
38
# File 'lib/oci/mngdmac/models/mac_device.rb', line 36

def serial_number
  @serial_number
end

#shapeString

[Required] The shape of the Mac.

Returns:

  • (String)


48
49
50
# File 'lib/oci/mngdmac/models/mac_device.rb', line 48

def shape
  @shape
end

#time_createdDateTime

[Required] The time this resource was created. An RFC3339 formatted datetime string.

Returns:

  • (DateTime)


52
53
54
# File 'lib/oci/mngdmac/models/mac_device.rb', line 52

def time_created
  @time_created
end

#time_decomDateTime

[Required] An RFC3339-formatted datetime string containing the time this MacDevice was decommissioned.

Returns:

  • (DateTime)


64
65
66
# File 'lib/oci/mngdmac/models/mac_device.rb', line 64

def time_decom
  @time_decom
end

#time_updatedDateTime

[Required] The time this resource was last updated. An RFC3339 formatted datetime string.

Returns:

  • (DateTime)


56
57
58
# File 'lib/oci/mngdmac/models/mac_device.rb', line 56

def time_updated
  @time_updated
end

Class Method Details

.attribute_mapObject

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



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/oci/mngdmac/models/mac_device.rb', line 67

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'compartment_id': :'compartmentId',
    'mac_order_id': :'macOrderId',
    'serial_number': :'serialNumber',
    'ip_address': :'ipAddress',
    'lifecycle_state': :'lifecycleState',
    'shape': :'shape',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'is_marked_decom': :'isMarkedDecom',
    'time_decom': :'timeDecom'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/oci/mngdmac/models/mac_device.rb', line 86

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'compartment_id': :'String',
    'mac_order_id': :'String',
    'serial_number': :'String',
    'ip_address': :'String',
    'lifecycle_state': :'String',
    'shape': :'String',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'is_marked_decom': :'BOOLEAN',
    'time_decom': :'DateTime'
    # 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



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/mngdmac/models/mac_device.rb', line 208

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

  self.class == other.class &&
    id == other.id &&
    compartment_id == other.compartment_id &&
    mac_order_id == other.mac_order_id &&
    serial_number == other.serial_number &&
    ip_address == other.ip_address &&
    lifecycle_state == other.lifecycle_state &&
    shape == other.shape &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    is_marked_decom == other.is_marked_decom &&
    time_decom == other.time_decom
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



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/oci/mngdmac/models/mac_device.rb', line 248

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


228
229
230
# File 'lib/oci/mngdmac/models/mac_device.rb', line 228

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



237
238
239
# File 'lib/oci/mngdmac/models/mac_device.rb', line 237

def hash
  [id, compartment_id, mac_order_id, serial_number, ip_address, lifecycle_state, shape, time_created, time_updated, is_marked_decom, time_decom].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



281
282
283
284
285
286
287
288
289
290
# File 'lib/oci/mngdmac/models/mac_device.rb', line 281

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



275
276
277
# File 'lib/oci/mngdmac/models/mac_device.rb', line 275

def to_s
  to_hash.to_s
end