Class: OCI::Batch::Models::BatchTaskSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/batch/models/batch_task_summary.rb

Overview

Summary information about a batch task. 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

ComputeTaskSummary, GroupTaskSummary

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BatchTaskSummary

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

  • :job_id (String)

    The value to assign to the #job_id property

  • :name (String)

    The value to assign to the #name property

  • :hierarchical_name (String)

    The value to assign to the #hierarchical_name property

  • :group_task_name (String)

    The value to assign to the #group_task_name property

  • :description (String)

    The value to assign to the #description property

  • :lifecycle_state (String)

    The value to assign to the #lifecycle_state property

  • :lifecycle_details (String)

    The value to assign to the #lifecycle_details property

  • :type (String)

    The value to assign to the #type property



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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/batch/models/batch_task_summary.rb', line 114

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

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

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

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

  self.hierarchical_name = attributes[:'hierarchicalName'] if attributes[:'hierarchicalName']

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

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

  self.group_task_name = attributes[:'groupTaskName'] if attributes[:'groupTaskName']

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

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

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

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

Instance Attribute Details

#descriptionString

An optional description that provides additional context next to the displayName.

Returns:

  • (String)


34
35
36
# File 'lib/oci/batch/models/batch_task_summary.rb', line 34

def description
  @description
end

#group_task_nameString

The hierarchical name of the group task. Null for top-level tasks.

Returns:

  • (String)


30
31
32
# File 'lib/oci/batch/models/batch_task_summary.rb', line 30

def group_task_name
  @group_task_name
end

#hierarchical_nameString

The hierarchical name of the task, which incorporates names of all parent group tasks, separated by "." (dot symbol). Maximum nesting depth is 4 levels. Example: groupTaskA.nestedGroupTaskB.thisTaskName

Returns:

  • (String)


26
27
28
# File 'lib/oci/batch/models/batch_task_summary.rb', line 26

def hierarchical_name
  @hierarchical_name
end

#idString

[Required] The UUID of batch task.

Returns:

  • (String)


14
15
16
# File 'lib/oci/batch/models/batch_task_summary.rb', line 14

def id
  @id
end

#job_idString

[Required] The OCID of the batch job to which this task belongs.

Returns:

  • (String)


18
19
20
# File 'lib/oci/batch/models/batch_task_summary.rb', line 18

def job_id
  @job_id
end

#lifecycle_detailsString

A message that describes the current state of the batch task in more detail. For example, can be used to provide actionable information for a resource in the Failed state.

Returns:

  • (String)


43
44
45
# File 'lib/oci/batch/models/batch_task_summary.rb', line 43

def lifecycle_details
  @lifecycle_details
end

#lifecycle_stateString

The current state of the batch task.

Returns:

  • (String)


38
39
40
# File 'lib/oci/batch/models/batch_task_summary.rb', line 38

def lifecycle_state
  @lifecycle_state
end

#nameString

[Required] The name of the batch task. It must be unique within its parent batch job.

Returns:

  • (String)


22
23
24
# File 'lib/oci/batch/models/batch_task_summary.rb', line 22

def name
  @name
end

#typeString

[Required] Type of the batch task. Also serves as a discriminator for sub-entities.

Returns:

  • (String)


47
48
49
# File 'lib/oci/batch/models/batch_task_summary.rb', line 47

def type
  @type
end

Class Method Details

.attribute_mapObject

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



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/oci/batch/models/batch_task_summary.rb', line 50

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'job_id': :'jobId',
    'name': :'name',
    'hierarchical_name': :'hierarchicalName',
    'group_task_name': :'groupTaskName',
    'description': :'description',
    'lifecycle_state': :'lifecycleState',
    'lifecycle_details': :'lifecycleDetails',
    'type': :'type'
    # 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.



88
89
90
91
92
93
94
95
96
# File 'lib/oci/batch/models/batch_task_summary.rb', line 88

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

  return 'OCI::Batch::Models::ComputeTaskSummary' if type == 'COMPUTE'
  return 'OCI::Batch::Models::GroupTaskSummary' if type == 'GROUP'

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

.swagger_typesObject

Attribute type mapping.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/oci/batch/models/batch_task_summary.rb', line 67

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'job_id': :'String',
    'name': :'String',
    'hierarchical_name': :'String',
    'group_task_name': :'String',
    'description': :'String',
    'lifecycle_state': :'String',
    'lifecycle_details': :'String',
    '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



166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/oci/batch/models/batch_task_summary.rb', line 166

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

  self.class == other.class &&
    id == other.id &&
    job_id == other.job_id &&
    name == other.name &&
    hierarchical_name == other.hierarchical_name &&
    group_task_name == other.group_task_name &&
    description == other.description &&
    lifecycle_state == other.lifecycle_state &&
    lifecycle_details == other.lifecycle_details &&
    type == other.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



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/batch/models/batch_task_summary.rb', line 204

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


184
185
186
# File 'lib/oci/batch/models/batch_task_summary.rb', line 184

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



193
194
195
# File 'lib/oci/batch/models/batch_task_summary.rb', line 193

def hash
  [id, job_id, name, hierarchical_name, group_task_name, description, lifecycle_state, lifecycle_details, type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



237
238
239
240
241
242
243
244
245
246
# File 'lib/oci/batch/models/batch_task_summary.rb', line 237

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



231
232
233
# File 'lib/oci/batch/models/batch_task_summary.rb', line 231

def to_s
  to_hash.to_s
end