Class: OCI::Oda::Models::WorkRequestResource

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/oda/models/work_request_resource.rb

Overview

A resource created or operated on by a work request.

Constant Summary collapse

RESOURCE_ACTION_ENUM =
[
  RESOURCE_ACTION_CREATE = 'CREATE'.freeze,
  RESOURCE_ACTION_DELETE = 'DELETE'.freeze,
  RESOURCE_ACTION_PURGE = 'PURGE'.freeze,
  RESOURCE_ACTION_RECOVER = 'RECOVER'.freeze,
  RESOURCE_ACTION_STOP = 'STOP'.freeze,
  RESOURCE_ACTION_START = 'START'.freeze,
  RESOURCE_ACTION_CHANGE_COMPARTMENT = 'CHANGE_COMPARTMENT'.freeze,
  RESOURCE_ACTION_CREATE_ASSOCIATION = 'CREATE_ASSOCIATION'.freeze,
  RESOURCE_ACTION_DELETE_ASSOCIATION = 'DELETE_ASSOCIATION'.freeze,
  RESOURCE_ACTION_UPDATE_ENTITLEMENTS_FOR_CACCT = 'UPDATE_ENTITLEMENTS_FOR_CACCT'.freeze,
  RESOURCE_ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
STATUS_ENUM =
[
  STATUS_ACCEPTED = 'ACCEPTED'.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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ WorkRequestResource

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :resource_action (String)

    The value to assign to the #resource_action property

  • :resource_type (String)

    The value to assign to the #resource_type property

  • :resource_id (String)

    The value to assign to the #resource_id property

  • :status (String)

    The value to assign to the #status property

  • :status_message (String)

    The value to assign to the #status_message property

  • :resource_uri (String)

    The value to assign to the #resource_uri property



103
104
105
106
107
108
109
110
111
112
113
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
# File 'lib/oci/oda/models/work_request_resource.rb', line 103

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

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

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

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

  self.status_message = attributes[:'statusMessage'] if attributes[:'statusMessage']

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

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

  self.resource_uri = attributes[:'resourceUri'] if attributes[:'resourceUri']

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

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

Instance Attribute Details

#resource_actionString

[Required] The action to take against the Digital Assistant instance.

Returns:

  • (String)


37
38
39
# File 'lib/oci/oda/models/work_request_resource.rb', line 37

def resource_action
  @resource_action
end

#resource_idString

[Required] The identifier of the Digital Assistant instance that is the subject of the request.

Returns:

  • (String)


45
46
47
# File 'lib/oci/oda/models/work_request_resource.rb', line 45

def resource_id
  @resource_id
end

#resource_typeString

[Required] The resource type that the work request affects.

Returns:

  • (String)


41
42
43
# File 'lib/oci/oda/models/work_request_resource.rb', line 41

def resource_type
  @resource_type
end

#resource_uriString

The URI path that the user can do a GET on to access the resource metadata.

Returns:

  • (String)


61
62
63
# File 'lib/oci/oda/models/work_request_resource.rb', line 61

def resource_uri
  @resource_uri
end

#statusString

[Required] The current state of the work request. The SUCCEEDED, FAILED, AND CANCELED states correspond to the action being performed.

Returns:

  • (String)


51
52
53
# File 'lib/oci/oda/models/work_request_resource.rb', line 51

def status
  @status
end

#status_messageString

Short message providing more detail for the current status. For example, if an operation fails this may include information about the reason for the failure and a possible resolution.

Returns:

  • (String)


57
58
59
# File 'lib/oci/oda/models/work_request_resource.rb', line 57

def status_message
  @status_message
end

Class Method Details

.attribute_mapObject

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



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/oci/oda/models/work_request_resource.rb', line 64

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_action': :'resourceAction',
    'resource_type': :'resourceType',
    'resource_id': :'resourceId',
    'status': :'status',
    'status_message': :'statusMessage',
    'resource_uri': :'resourceUri'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/oci/oda/models/work_request_resource.rb', line 78

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_action': :'String',
    'resource_type': :'String',
    'resource_id': :'String',
    'status': :'String',
    'status_message': :'String',
    'resource_uri': :'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



175
176
177
178
179
180
181
182
183
184
185
# File 'lib/oci/oda/models/work_request_resource.rb', line 175

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

  self.class == other.class &&
    resource_action == other.resource_action &&
    resource_type == other.resource_type &&
    resource_id == other.resource_id &&
    status == other.status &&
    status_message == other.status_message &&
    resource_uri == other.resource_uri
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



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/oci/oda/models/work_request_resource.rb', line 210

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


190
191
192
# File 'lib/oci/oda/models/work_request_resource.rb', line 190

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



199
200
201
# File 'lib/oci/oda/models/work_request_resource.rb', line 199

def hash
  [resource_action, resource_type, resource_id, status, status_message, resource_uri].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



243
244
245
246
247
248
249
250
251
252
# File 'lib/oci/oda/models/work_request_resource.rb', line 243

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



237
238
239
# File 'lib/oci/oda/models/work_request_resource.rb', line 237

def to_s
  to_hash.to_s
end