Class: OCI::Optimizer::Models::BulkApplyResourceAction

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

Overview

The resource action that a recommendation will be applied to.

Constant Summary collapse

STATUS_ENUM =
[
  STATUS_PENDING = 'PENDING'.freeze,
  STATUS_DISMISSED = 'DISMISSED'.freeze,
  STATUS_POSTPONED = 'POSTPONED'.freeze,
  STATUS_IMPLEMENTED = 'IMPLEMENTED'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BulkApplyResourceAction

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :resource_action_id (String)

    The value to assign to the #resource_action_id property

  • :status (String)

    The value to assign to the #status property

  • :time_status_end (DateTime)

    The value to assign to the #time_status_end property

  • :parameters (Hash<String, Object>)

    The value to assign to the #parameters property

  • :strategy_name (String)

    The value to assign to the #strategy_name property



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 82

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

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

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

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

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

  self.strategy_name = attributes[:'strategyName'] if attributes[:'strategyName']

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

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

Instance Attribute Details

#parametersHash<String, Object>

Additional parameter key-value pairs defining the resource action. For example:

`15, "timeUnit": "seconds"`

Returns:

  • (Hash<String, Object>)


39
40
41
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 39

def parameters
  @parameters
end

#resource_action_idString

**[Required]** The unique OCIDs of the resource actions that recommendations are applied to.

Returns:

  • (String)


19
20
21
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 19

def resource_action_id
  @resource_action_id
end

#statusString

The current status of the recommendation.

Returns:

  • (String)


23
24
25
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 23

def status
  @status
end

#strategy_nameString

The name of the strategy.

Returns:

  • (String)


43
44
45
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 43

def strategy_name
  @strategy_name
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)


31
32
33
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 31

def time_status_end
  @time_status_end
end

Class Method Details

.attribute_mapObject

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



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 46

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_action_id': :'resourceActionId',
    'status': :'status',
    'time_status_end': :'timeStatusEnd',
    'parameters': :'parameters',
    'strategy_name': :'strategyName'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 59

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_action_id': :'String',
    'status': :'String',
    'time_status_end': :'DateTime',
    'parameters': :'Hash<String, Object>',
    'strategy_name': :'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



126
127
128
129
130
131
132
133
134
135
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 126

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

  self.class == other.class &&
    resource_action_id == other.resource_action_id &&
    status == other.status &&
    time_status_end == other.time_status_end &&
    parameters == other.parameters &&
    strategy_name == other.strategy_name
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



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

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


140
141
142
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 140

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



149
150
151
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 149

def hash
  [resource_action_id, status, time_status_end, parameters, strategy_name].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



193
194
195
196
197
198
199
200
201
202
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 193

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



187
188
189
# File 'lib/oci/optimizer/models/bulk_apply_resource_action.rb', line 187

def to_s
  to_hash.to_s
end