Class: OCI::CloudMigrations::Models::TargetAsset

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/cloud_migrations/models/target_asset.rb

Overview

Description of the target asset. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Direct Known Subclasses

VmTargetAsset

Constant Summary collapse

LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
  LIFECYCLE_STATE_NEEDS_ATTENTION = 'NEEDS_ATTENTION'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
TYPE_ENUM =
[
  TYPE_INSTANCE = 'INSTANCE'.freeze,
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TargetAsset

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 170

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

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

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

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

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

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

  self.migration_plan_id = attributes[:'migrationPlanId'] if attributes[:'migrationPlanId']

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

  self.migration_plan_id = attributes[:'migration_plan_id'] if attributes[:'migration_plan_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.created_resource_id = attributes[:'createdResourceId'] if attributes[:'createdResourceId']

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

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

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

  self.is_excluded_from_execution = attributes[:'isExcludedFromExecution'] unless attributes[:'isExcludedFromExecution'].nil?

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

  self.is_excluded_from_execution = attributes[:'is_excluded_from_execution'] unless attributes[:'is_excluded_from_execution'].nil?

  self.compatibility_messages = attributes[:'compatibilityMessages'] if attributes[:'compatibilityMessages']

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

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

  self.estimated_cost = attributes[:'estimatedCost'] if attributes[:'estimatedCost']

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

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

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

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

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

  self.migration_asset = attributes[:'migrationAsset'] if attributes[:'migrationAsset']

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

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

Instance Attribute Details

#compartment_idString

Compartment identifier

Returns:

  • (String)


51
52
53
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 51

def compartment_id
  @compartment_id
end

#compatibility_messagesArray<OCI::CloudMigrations::Models::CompatibilityMessage>

Messages about the compatibility issues.



67
68
69
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 67

def compatibility_messages
  @compatibility_messages
end

#created_resource_idString

Created resource identifier

Returns:

  • (String)


55
56
57
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 55

def created_resource_id
  @created_resource_id
end

#display_nameString

A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

Returns:

  • (String)


35
36
37
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 35

def display_name
  @display_name
end

#estimated_costOCI::CloudMigrations::Models::CostEstimation

This attribute is required.



71
72
73
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 71

def estimated_cost
  @estimated_cost
end

#idString

[Required] Unique identifier that is immutable on creation.

Returns:

  • (String)


31
32
33
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 31

def id
  @id
end

#is_excluded_from_executionBOOLEAN

[Required] A boolean indicating whether the asset should be migrated.

Returns:

  • (BOOLEAN)


63
64
65
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 63

def is_excluded_from_execution
  @is_excluded_from_execution
end

#lifecycle_detailsString

A message describing the current state in more detail. For example, it can be used to provide actionable information for a resource in Failed state.

Returns:

  • (String)


43
44
45
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 43

def lifecycle_details
  @lifecycle_details
end

#lifecycle_stateString

[Required] The current state of the target asset.

Returns:

  • (String)


39
40
41
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 39

def lifecycle_state
  @lifecycle_state
end

#migration_assetOCI::CloudMigrations::Models::MigrationAsset



86
87
88
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 86

def migration_asset
  @migration_asset
end

#migration_plan_idString

[Required] OCID of the associated migration plan.

Returns:

  • (String)


47
48
49
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 47

def migration_plan_id
  @migration_plan_id
end

#time_assessedDateTime

[Required] The time when the assessment was done. An RFC3339 formatted datetime string.

Returns:

  • (DateTime)


83
84
85
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 83

def time_assessed
  @time_assessed
end

#time_createdDateTime

[Required] The time when the target asset was created. An RFC3339 formatted datetime string.

Returns:

  • (DateTime)


75
76
77
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 75

def time_created
  @time_created
end

#time_updatedDateTime

[Required] The time when the target asset was updated. An RFC3339 formatted datetime string.

Returns:

  • (DateTime)


79
80
81
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 79

def time_updated
  @time_updated
end

#typeString

[Required] The type of target asset.

Returns:

  • (String)


59
60
61
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 59

def type
  @type
end

Class Method Details

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 89

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'display_name': :'displayName',
    'lifecycle_state': :'lifecycleState',
    'lifecycle_details': :'lifecycleDetails',
    'migration_plan_id': :'migrationPlanId',
    'compartment_id': :'compartmentId',
    'created_resource_id': :'createdResourceId',
    'type': :'type',
    'is_excluded_from_execution': :'isExcludedFromExecution',
    'compatibility_messages': :'compatibilityMessages',
    'estimated_cost': :'estimatedCost',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'time_assessed': :'timeAssessed',
    'migration_asset': :'migrationAsset'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



139
140
141
142
143
144
145
146
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 139

def self.get_subtype(object_hash)
  type = object_hash[:'type'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::CloudMigrations::Models::VmTargetAsset' if type == 'INSTANCE'

  # TODO: Log a warning when the subtype is not found.
  'OCI::CloudMigrations::Models::TargetAsset'
end

.swagger_typesObject

Attribute type mapping.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 112

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'display_name': :'String',
    'lifecycle_state': :'String',
    'lifecycle_details': :'String',
    'migration_plan_id': :'String',
    'compartment_id': :'String',
    'created_resource_id': :'String',
    'type': :'String',
    'is_excluded_from_execution': :'BOOLEAN',
    'compatibility_messages': :'Array<OCI::CloudMigrations::Models::CompatibilityMessage>',
    'estimated_cost': :'OCI::CloudMigrations::Models::CostEstimation',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'time_assessed': :'DateTime',
    'migration_asset': :'OCI::CloudMigrations::Models::MigrationAsset'
    # 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



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 292

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

  self.class == other.class &&
    id == other.id &&
    display_name == other.display_name &&
    lifecycle_state == other.lifecycle_state &&
    lifecycle_details == other.lifecycle_details &&
    migration_plan_id == other.migration_plan_id &&
    compartment_id == other.compartment_id &&
    created_resource_id == other.created_resource_id &&
    type == other.type &&
    is_excluded_from_execution == other.is_excluded_from_execution &&
    compatibility_messages == other.compatibility_messages &&
    estimated_cost == other.estimated_cost &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    time_assessed == other.time_assessed &&
    migration_asset == other.migration_asset
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



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 336

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


316
317
318
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 316

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



325
326
327
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 325

def hash
  [id, display_name, lifecycle_state, lifecycle_details, migration_plan_id, compartment_id, created_resource_id, type, is_excluded_from_execution, compatibility_messages, estimated_cost, time_created, time_updated, time_assessed, migration_asset].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



369
370
371
372
373
374
375
376
377
378
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 369

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



363
364
365
# File 'lib/oci/cloud_migrations/models/target_asset.rb', line 363

def to_s
  to_hash.to_s
end