Class: OCI::Optimizer::Models::ResourceActionSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/optimizer/models/resource_action_summary.rb

Overview

The metadata associated with the resource action summary.

Constant Summary collapse

LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
  LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze,
  LIFECYCLE_STATE_ATTACHING = 'ATTACHING'.freeze,
  LIFECYCLE_STATE_DETACHING = 'DETACHING'.freeze,
  LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
STATUS_ENUM =
[
  STATUS_PENDING = 'PENDING'.freeze,
  STATUS_DISMISSED = 'DISMISSED'.freeze,
  STATUS_POSTPONED = 'POSTPONED'.freeze,
  STATUS_IMPLEMENTED = 'IMPLEMENTED'.freeze,
  STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ResourceActionSummary

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

  • :category_id (String)

    The value to assign to the #category_id property

  • :recommendation_id (String)

    The value to assign to the #recommendation_id property

  • :resource_id (String)

    The value to assign to the #resource_id property

  • :name (String)

    The value to assign to the #name property

  • :resource_type (String)

    The value to assign to the #resource_type property

  • :compartment_id (String)

    The value to assign to the #compartment_id property

  • :compartment_name (String)

    The value to assign to the #compartment_name property

  • :action (OCI::Optimizer::Models::Action)

    The value to assign to the #action property

  • :lifecycle_state (String)

    The value to assign to the #lifecycle_state property

  • :estimated_cost_saving (Float)

    The value to assign to the #estimated_cost_saving property

  • :status (String)

    The value to assign to the #status property

  • :time_status_begin (DateTime)

    The value to assign to the #time_status_begin property

  • :time_status_end (DateTime)

    The value to assign to the #time_status_end property

  • :metadata (Hash<String, String>)

    The value to assign to the #metadata property

  • :extended_metadata (Hash<String, Object>)

    The value to assign to the #extended_metadata 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



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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 209

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

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

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

  self.recommendation_id = attributes[:'recommendationId'] if attributes[:'recommendationId']

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

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

  self.resource_id = attributes[:'resourceId'] if attributes[:'resourceId']

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

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

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

  self.resource_type = attributes[:'resourceType'] if attributes[:'resourceType']

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

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

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

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

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

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

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

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

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

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

  self.time_status_begin = attributes[:'timeStatusBegin'] if attributes[:'timeStatusBegin']

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

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

  self.time_status_end = attributes[:'timeStatusEnd'] if attributes[:'timeStatusEnd']

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

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

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

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

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

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

  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']
end

Instance Attribute Details

#actionOCI::Optimizer::Models::Action

This attribute is required.



68
69
70
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 68

def action
  @action
end

#category_idString

[Required] The unique OCID associated with the category.

Returns:

  • (String)


40
41
42
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 40

def category_id
  @category_id
end

#compartment_idString

[Required] The OCID of the compartment.

Returns:

  • (String)


60
61
62
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 60

def compartment_id
  @compartment_id
end

#compartment_nameString

[Required] The name associated with the compartment.

Returns:

  • (String)


64
65
66
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 64

def compartment_name
  @compartment_name
end

#estimated_cost_savingFloat

[Required] The estimated cost savings, in dollars, for the resource action.

Returns:

  • (Float)


76
77
78
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 76

def estimated_cost_saving
  @estimated_cost_saving
end

#extended_metadataHash<String, Object>

Additional metadata key/value pairs that you provide. They serve the same purpose and functionality as fields in the metadata object.

They are distinguished from metadata fields in that these can be nested JSON objects (whereas metadata fields are string/string maps only).

For example:

{\"CurrentShape\": {\"name\":\"VM.Standard2.16\"}, \"RecommendedShape\": {\"name\":\"VM.Standard2.8\"}}

Returns:

  • (Hash<String, Object>)


123
124
125
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 123

def 
  @extended_metadata
end

#idString

[Required] The unique OCID associated with the resource action.

Returns:

  • (String)


36
37
38
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 36

def id
  @id
end

#lifecycle_stateString

[Required] The resource action's current state.

Returns:

  • (String)


72
73
74
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 72

def lifecycle_state
  @lifecycle_state
end

#metadataHash<String, String>

Custom metadata key/value pairs for the resource action.

Metadata Example

  \"metadata\" : {
     \"cpuRecommendedShape\": \"VM.Standard1.1\",
     \"computeMemoryUtilization\": \"26.05734124418388\",
     \"currentShape\": \"VM.Standard1.2\",
     \"instanceRecommendedShape\": \"VM.Standard1.1\",
     \"computeCpuUtilization\": \"7.930035319720132\",
     \"memoryRecommendedShape\": \"None\"
  }

Returns:

  • (Hash<String, String>)


111
112
113
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 111

def 
  @metadata
end

#nameString

[Required] The name assigned to the resource.

Returns:

  • (String)


52
53
54
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 52

def name
  @name
end

#recommendation_idString

[Required] The unique OCID associated with the recommendation.

Returns:

  • (String)


44
45
46
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 44

def recommendation_id
  @recommendation_id
end

#resource_idString

[Required] The unique OCID associated with the resource.

Returns:

  • (String)


48
49
50
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 48

def resource_id
  @resource_id
end

#resource_typeString

[Required] The kind of resource.

Returns:

  • (String)


56
57
58
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 56

def resource_type
  @resource_type
end

#statusString

[Required] The current status of the resource action.

Returns:

  • (String)


80
81
82
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 80

def status
  @status
end

#time_createdDateTime

The date and time the resource action details were created, in the format defined by RFC3339.

Returns:

  • (DateTime)


127
128
129
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 127

def time_created
  @time_created
end

#time_status_beginDateTime

[Required] The date and time that the resource action entered its current status. The format is defined by RFC3339.

For example, "The status of the resource action changed from pending to current(ignored) on this date and time."

Returns:

  • (DateTime)


87
88
89
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 87

def time_status_begin
  @time_status_begin
end

#time_status_endDateTime

The date and time the current status will change. The format is defined by RFC3339.

For example, "The current postponed status of the resource action will end and change to pending on this date and time."

Returns:

  • (DateTime)


95
96
97
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 95

def time_status_end
  @time_status_end
end

#time_updatedDateTime

The date and time the resource action details were last updated, in the format defined by RFC3339.

Returns:

  • (DateTime)


131
132
133
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 131

def time_updated
  @time_updated
end

Class Method Details

.attribute_mapObject

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



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 134

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'category_id': :'categoryId',
    'recommendation_id': :'recommendationId',
    'resource_id': :'resourceId',
    'name': :'name',
    'resource_type': :'resourceType',
    'compartment_id': :'compartmentId',
    'compartment_name': :'compartmentName',
    'action': :'action',
    'lifecycle_state': :'lifecycleState',
    'estimated_cost_saving': :'estimatedCostSaving',
    'status': :'status',
    'time_status_begin': :'timeStatusBegin',
    'time_status_end': :'timeStatusEnd',
    'metadata': :'metadata',
    'extended_metadata': :'extendedMetadata',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 160

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'category_id': :'String',
    'recommendation_id': :'String',
    'resource_id': :'String',
    'name': :'String',
    'resource_type': :'String',
    'compartment_id': :'String',
    'compartment_name': :'String',
    'action': :'OCI::Optimizer::Models::Action',
    'lifecycle_state': :'String',
    'estimated_cost_saving': :'Float',
    'status': :'String',
    'time_status_begin': :'DateTime',
    'time_status_end': :'DateTime',
    'metadata': :'Hash<String, String>',
    'extended_metadata': :'Hash<String, Object>',
    'time_created': :'DateTime',
    'time_updated': :'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



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

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

  self.class == other.class &&
    id == other.id &&
    category_id == other.category_id &&
    recommendation_id == other.recommendation_id &&
    resource_id == other.resource_id &&
    name == other.name &&
    resource_type == other.resource_type &&
    compartment_id == other.compartment_id &&
    compartment_name == other.compartment_name &&
    action == other.action &&
    lifecycle_state == other.lifecycle_state &&
    estimated_cost_saving == other.estimated_cost_saving &&
    status == other.status &&
    time_status_begin == other.time_status_begin &&
    time_status_end == other.time_status_end &&
     == other. &&
     == other. &&
    time_created == other.time_created &&
    time_updated == other.time_updated
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



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 384

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


364
365
366
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 364

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



373
374
375
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 373

def hash
  [id, category_id, recommendation_id, resource_id, name, resource_type, compartment_id, compartment_name, action, lifecycle_state, estimated_cost_saving, status, time_status_begin, time_status_end, , , time_created, time_updated].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



417
418
419
420
421
422
423
424
425
426
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 417

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



411
412
413
# File 'lib/oci/optimizer/models/resource_action_summary.rb', line 411

def to_s
  to_hash.to_s
end