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_UPDATE = 'UPDATE'.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



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
# File 'lib/oci/oda/models/work_request_resource.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.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 resource.

Returns:

  • (String)


48
49
50
# File 'lib/oci/oda/models/work_request_resource.rb', line 48

def resource_action
  @resource_action
end

#resource_idString

[Required] The identifier of the resource that is the subject of the request.

Returns:

  • (String)


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

def resource_id
  @resource_id
end

#resource_typeString

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

Returns:

  • (String)


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

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)


72
73
74
# File 'lib/oci/oda/models/work_request_resource.rb', line 72

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)


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

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)


68
69
70
# File 'lib/oci/oda/models/work_request_resource.rb', line 68

def status_message
  @status_message
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


201
202
203
# File 'lib/oci/oda/models/work_request_resource.rb', line 201

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



210
211
212
# File 'lib/oci/oda/models/work_request_resource.rb', line 210

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



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

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



248
249
250
# File 'lib/oci/oda/models/work_request_resource.rb', line 248

def to_s
  to_hash.to_s
end