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_CHANGE_CUST_ENC_KEY = 'CHANGE_CUST_ENC_KEY'.freeze,
  RESOURCE_ACTION_DEACT_CUST_ENC_KEY = 'DEACT_CUST_ENC_KEY'.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_CREATE_ODA_INSTANCE_ATTACHMENT = 'CREATE_ODA_INSTANCE_ATTACHMENT'.freeze,
  RESOURCE_ACTION_UPDATE_ODA_INSTANCE_ATTACHMENT = 'UPDATE_ODA_INSTANCE_ATTACHMENT'.freeze,
  RESOURCE_ACTION_DELETE_ODA_INSTANCE_ATTACHMENT = 'DELETE_ODA_INSTANCE_ATTACHMENT'.freeze,
  RESOURCE_ACTION_CREATE_IMPORTED_PACKAGE = 'CREATE_IMPORTED_PACKAGE'.freeze,
  RESOURCE_ACTION_UPDATE_IMPORTED_PACKAGE = 'UPDATE_IMPORTED_PACKAGE'.freeze,
  RESOURCE_ACTION_DELETE_IMPORTED_PACKAGE = 'DELETE_IMPORTED_PACKAGE'.freeze,
  RESOURCE_ACTION_EXPORT = 'EXPORT'.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



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
141
142
143
144
145
146
147
148
149
# File 'lib/oci/oda/models/work_request_resource.rb', line 112

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)


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

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)


54
55
56
# File 'lib/oci/oda/models/work_request_resource.rb', line 54

def resource_id
  @resource_id
end

#resource_typeString

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

Returns:

  • (String)


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

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)


70
71
72
# File 'lib/oci/oda/models/work_request_resource.rb', line 70

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)


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

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)


66
67
68
# File 'lib/oci/oda/models/work_request_resource.rb', line 66

def status_message
  @status_message
end

Class Method Details

.attribute_mapObject

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



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/oci/oda/models/work_request_resource.rb', line 73

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.



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/oci/oda/models/work_request_resource.rb', line 87

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



184
185
186
187
188
189
190
191
192
193
194
# File 'lib/oci/oda/models/work_request_resource.rb', line 184

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



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/oci/oda/models/work_request_resource.rb', line 219

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


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

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



208
209
210
# File 'lib/oci/oda/models/work_request_resource.rb', line 208

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



252
253
254
255
256
257
258
259
260
261
# File 'lib/oci/oda/models/work_request_resource.rb', line 252

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



246
247
248
# File 'lib/oci/oda/models/work_request_resource.rb', line 246

def to_s
  to_hash.to_s
end