Class: OCI::LogAnalytics::Models::StandardTask

Inherits:
ScheduledTask show all
Defined in:
lib/oci/log_analytics/models/standard_task.rb

Overview

Log analytics scheduled task resource.

Constant Summary collapse

LAST_EXECUTION_STATUS_ENUM =
[
  LAST_EXECUTION_STATUS_FAILED = 'FAILED'.freeze,
  LAST_EXECUTION_STATUS_SUCCEEDED = 'SUCCEEDED'.freeze,
  LAST_EXECUTION_STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from ScheduledTask

OCI::LogAnalytics::Models::ScheduledTask::KIND_ENUM, OCI::LogAnalytics::Models::ScheduledTask::LIFECYCLE_STATE_ENUM, OCI::LogAnalytics::Models::ScheduledTask::PAUSE_REASON_ENUM, OCI::LogAnalytics::Models::ScheduledTask::TASK_STATUS_ENUM, OCI::LogAnalytics::Models::ScheduledTask::TASK_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from ScheduledTask

#action, #compartment_id, #defined_tags, #display_name, #freeform_tags, #id, #kind, #lifecycle_state, #num_occurrences, #pause_reason, #schedules, #task_status, #task_type, #time_created, #time_of_next_execution, #time_updated, #work_request_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ScheduledTask

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ StandardTask

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/oci/log_analytics/models/standard_task.rb', line 106

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['kind'] = 'STANDARD'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.last_execution_status = attributes[:'lastExecutionStatus'] if attributes[:'lastExecutionStatus']

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

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

  self.time_last_executed = attributes[:'timeLastExecuted'] if attributes[:'timeLastExecuted']

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

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

Instance Attribute Details

#last_execution_statusString

The most recent task execution status.

Returns:

  • (String)


22
23
24
# File 'lib/oci/log_analytics/models/standard_task.rb', line 22

def last_execution_status
  @last_execution_status
end

#time_last_executedDateTime

The date and time the scheduled task last executed, in the format defined by RFC3339.

Returns:

  • (DateTime)


26
27
28
# File 'lib/oci/log_analytics/models/standard_task.rb', line 26

def time_last_executed
  @time_last_executed
end

Class Method Details

.attribute_mapObject

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



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/oci/log_analytics/models/standard_task.rb', line 29

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'kind': :'kind',
    'id': :'id',
    'display_name': :'displayName',
    'task_type': :'taskType',
    'schedules': :'schedules',
    'action': :'action',
    'task_status': :'taskStatus',
    'pause_reason': :'pauseReason',
    'work_request_id': :'workRequestId',
    'num_occurrences': :'numOccurrences',
    'compartment_id': :'compartmentId',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'time_of_next_execution': :'timeOfNextExecution',
    'lifecycle_state': :'lifecycleState',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags',
    'last_execution_status': :'lastExecutionStatus',
    'time_last_executed': :'timeLastExecuted'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/oci/log_analytics/models/standard_task.rb', line 56

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'kind': :'String',
    'id': :'String',
    'display_name': :'String',
    'task_type': :'String',
    'schedules': :'Array<OCI::LogAnalytics::Models::Schedule>',
    'action': :'OCI::LogAnalytics::Models::Action',
    'task_status': :'String',
    'pause_reason': :'String',
    'work_request_id': :'String',
    'num_occurrences': :'Integer',
    'compartment_id': :'String',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'time_of_next_execution': :'DateTime',
    'lifecycle_state': :'String',
    'freeform_tags': :'Hash<String, String>',
    'defined_tags': :'Hash<String, Hash<String, Object>>',
    'last_execution_status': :'String',
    'time_last_executed': :'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



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/oci/log_analytics/models/standard_task.rb', line 149

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

  self.class == other.class &&
    kind == other.kind &&
    id == other.id &&
    display_name == other.display_name &&
    task_type == other.task_type &&
    schedules == other.schedules &&
    action == other.action &&
    task_status == other.task_status &&
    pause_reason == other.pause_reason &&
    work_request_id == other.work_request_id &&
    num_occurrences == other.num_occurrences &&
    compartment_id == other.compartment_id &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    time_of_next_execution == other.time_of_next_execution &&
    lifecycle_state == other.lifecycle_state &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_tags &&
    last_execution_status == other.last_execution_status &&
    time_last_executed == other.time_last_executed
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



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/oci/log_analytics/models/standard_task.rb', line 197

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


177
178
179
# File 'lib/oci/log_analytics/models/standard_task.rb', line 177

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



186
187
188
# File 'lib/oci/log_analytics/models/standard_task.rb', line 186

def hash
  [kind, id, display_name, task_type, schedules, action, task_status, pause_reason, work_request_id, num_occurrences, compartment_id, time_created, time_updated, time_of_next_execution, lifecycle_state, freeform_tags, defined_tags, last_execution_status, time_last_executed].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



230
231
232
233
234
235
236
237
238
239
# File 'lib/oci/log_analytics/models/standard_task.rb', line 230

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



224
225
226
# File 'lib/oci/log_analytics/models/standard_task.rb', line 224

def to_s
  to_hash.to_s
end