Class: OCI::Adm::Models::RemediationRunStage

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/adm/models/remediation_run_stage.rb

Overview

A remediation run stage is one step of an remediation run. Each stage provides output logs and has a specific type. The stages are: DETECT, RECOMMEND, VERIFY, and APPLY.

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

ApplyStage, DetectStage, RecommendStage, VerifyStage

Constant Summary collapse

STATUS_ENUM =
[
  STATUS_CREATED = 'CREATED'.freeze,
  STATUS_IN_PROGRESS = 'IN_PROGRESS'.freeze,
  STATUS_SUCCEEDED = 'SUCCEEDED'.freeze,
  STATUS_FAILED = 'FAILED'.freeze,
  STATUS_CANCELING = 'CANCELING'.freeze,
  STATUS_CANCELED = 'CANCELED'.freeze,
  STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
TYPE_ENUM =
[
  TYPE_DETECT = 'DETECT'.freeze,
  TYPE_RECOMMEND = 'RECOMMEND'.freeze,
  TYPE_VERIFY = 'VERIFY'.freeze,
  TYPE_APPLY = 'APPLY'.freeze,
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
PREVIOUS_STAGE_TYPE_ENUM =
[
  PREVIOUS_STAGE_TYPE_DETECT = 'DETECT'.freeze,
  PREVIOUS_STAGE_TYPE_RECOMMEND = 'RECOMMEND'.freeze,
  PREVIOUS_STAGE_TYPE_VERIFY = 'VERIFY'.freeze,
  PREVIOUS_STAGE_TYPE_APPLY = 'APPLY'.freeze,
  PREVIOUS_STAGE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
NEXT_STAGE_TYPE_ENUM =
[
  NEXT_STAGE_TYPE_DETECT = 'DETECT'.freeze,
  NEXT_STAGE_TYPE_RECOMMEND = 'RECOMMEND'.freeze,
  NEXT_STAGE_TYPE_VERIFY = 'VERIFY'.freeze,
  NEXT_STAGE_TYPE_APPLY = 'APPLY'.freeze,
  NEXT_STAGE_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 = {}) ⇒ RemediationRunStage

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :status (String)

    The value to assign to the #status property

  • :time_created (DateTime)

    The value to assign to the #time_created property

  • :time_started (DateTime)

    The value to assign to the #time_started property

  • :time_finished (DateTime)

    The value to assign to the #time_finished property

  • :type (String)

    The value to assign to the #type property

  • :summary (String)

    The value to assign to the #summary property

  • :remediation_run_id (String)

    The value to assign to the #remediation_run_id property

  • :previous_stage_type (String)

    The value to assign to the #previous_stage_type property

  • :next_stage_type (String)

    The value to assign to the #next_stage_type property



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
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 152

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

  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_started = attributes[:'timeStarted'] if attributes[:'timeStarted']

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

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

  self.time_finished = attributes[:'timeFinished'] if attributes[:'timeFinished']

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

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

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

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

  self.remediation_run_id = attributes[:'remediationRunId'] if attributes[:'remediationRunId']

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

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

  self.previous_stage_type = attributes[:'previousStageType'] if attributes[:'previousStageType']

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

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

  self.next_stage_type = attributes[:'nextStageType'] if attributes[:'nextStageType']

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

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

Instance Attribute Details

#next_stage_typeString

The next type of stage in the remediation run.

Returns:

  • (String)


83
84
85
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 83

def next_stage_type
  @next_stage_type
end

#previous_stage_typeString

The previous type of stage in the remediation run.

Returns:

  • (String)


79
80
81
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 79

def previous_stage_type
  @previous_stage_type
end

#remediation_run_idString

[Required] The Oracle Cloud identifier (OCID) of the remediation run.

Returns:

  • (String)


75
76
77
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 75

def remediation_run_id
  @remediation_run_id
end

#statusString

[Required] The current status of a remediation run stage.

Returns:

  • (String)


51
52
53
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 51

def status
  @status
end

#summaryString

Information about the current step within the stage.

Returns:

  • (String)


71
72
73
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 71

def summary
  @summary
end

#time_createdDateTime

[Required] The creation date and time of the remediation run stage (formatted according to RFC3339).

Returns:

  • (DateTime)


55
56
57
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 55

def time_created
  @time_created
end

#time_finishedDateTime

The date and time of the finish of the remediation run stage (formatted according to RFC3339).

Returns:

  • (DateTime)


63
64
65
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 63

def time_finished
  @time_finished
end

#time_startedDateTime

The date and time of the start of the remediation run stage (formatted according to RFC3339).

Returns:

  • (DateTime)


59
60
61
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 59

def time_started
  @time_started
end

#typeString

[Required] The type of the remediation run stage.

Returns:

  • (String)


67
68
69
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 67

def type
  @type
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'status': :'status',
    'time_created': :'timeCreated',
    'time_started': :'timeStarted',
    'time_finished': :'timeFinished',
    'type': :'type',
    'summary': :'summary',
    'remediation_run_id': :'remediationRunId',
    'previous_stage_type': :'previousStageType',
    'next_stage_type': :'nextStageType'
    # 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.



124
125
126
127
128
129
130
131
132
133
134
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 124

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

  return 'OCI::Adm::Models::RecommendStage' if type == 'RECOMMEND'
  return 'OCI::Adm::Models::VerifyStage' if type == 'VERIFY'
  return 'OCI::Adm::Models::ApplyStage' if type == 'APPLY'
  return 'OCI::Adm::Models::DetectStage' if type == 'DETECT'

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

.swagger_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 103

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'status': :'String',
    'time_created': :'DateTime',
    'time_started': :'DateTime',
    'time_finished': :'DateTime',
    'type': :'String',
    'summary': :'String',
    'remediation_run_id': :'String',
    'previous_stage_type': :'String',
    'next_stage_type': :'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



260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 260

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

  self.class == other.class &&
    status == other.status &&
    time_created == other.time_created &&
    time_started == other.time_started &&
    time_finished == other.time_finished &&
    type == other.type &&
    summary == other.summary &&
    remediation_run_id == other.remediation_run_id &&
    previous_stage_type == other.previous_stage_type &&
    next_stage_type == other.next_stage_type
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



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 298

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


278
279
280
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 278

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



287
288
289
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 287

def hash
  [status, time_created, time_started, time_finished, type, summary, remediation_run_id, previous_stage_type, next_stage_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



331
332
333
334
335
336
337
338
339
340
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 331

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



325
326
327
# File 'lib/oci/adm/models/remediation_run_stage.rb', line 325

def to_s
  to_hash.to_s
end