Class: OCI::Audit::Models::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/audit/models/request.rb

Overview

A container object for request attributes.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Request

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

  • :path (String)

    The value to assign to the #path property

  • :action (String)

    The value to assign to the #action property

  • :parameters (Hash<String, Array<String>>)

    The value to assign to the #parameters property

  • :headers (Hash<String, Array<String>>)

    The value to assign to the #headers property



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/oci/audit/models/request.rb', line 118

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

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

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

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

Instance Attribute Details

#actionString

The HTTP method of the request.

Example: GET

Returns:

  • (String)


29
30
31
# File 'lib/oci/audit/models/request.rb', line 29

def action
  @action
end

#headersHash<String, Array<String>>

The HTTP header fields and values in the request.

Example:

—– { "opc-principal": [ "OCI::Audit::Models::Request.\“tenantId\”:\“ocid1.tenancy.oc1..<unique_ID>\”,\“subjectId\”:\“ocid1.user.oc1..<unique_ID>\”,\“claims\”:[{\“key\”:\“pstype\”,\“value\”:\“natv\”,\“issuer\”:\“authService\“tenantId\”:\“ocid1.tenancy.oc1..<unique_ID>\”,\“subjectId\”:\“ocid1.user.oc1..<unique_ID>\”,\“claims\”:[{\“key\”:\“pstype\”,\“value\”:\“natv\”,\“issuer\”:\“authService.oracle\“tenantId\”:\“ocid1.tenancy.oc1..<unique_ID>\”,\“subjectId\”:\“ocid1.user.oc1..<unique_ID>\”,\“claims\”:[{\“key\”:\“pstype\”,\“value\”:\“natv\”,\“issuer\”:\“authService.oracle.com\”,\“key\”:\“h_host\”,\“value\”:\“iaas.r2.oracleiaas.com\”,\“issuer\”:\“h\”,\“key\”:\“h_opc-request-id\”,\“value\”:\“<unique_ID>\”,\“issuer\”:\“h\”,OCI::Audit::Models::Request.\“key\”:\“ptype\”,\“value\”:\“user\”,\“issuer\”:\“authService\“key\”:\“ptype\”,\“value\”:\“user\”,\“issuer\”:\“authService.oracle\“key\”:\“ptype\”,\“value\”:\“user\”,\“issuer\”:\“authService.oracle.com\”,18 Sep 2019 00:10:58 UTC\”,\“issuer\”:\“h\”,\“key\”:\“h_accept\”,\“value\”:\“application/json\”,\“issuer\”:\“h\”,headers=\\”date (request-target) host accept opc-request-id\\“,keyId=\\”ocid1.tenancy.oc1..<unique_ID>/ocid1.user.oc1..<unique_ID>/8c:b4:5f:18:e7:ec:db:08:b8:fa:d2:2a:7d:11:76:ac\\“,algorithm=\\”rsa-pss-sha256\\“,signature=\\”<unique_ID>\\“,version=\\”1\\“\”,\“issuer\”:\“h\”,/20160918/instances/ocid1.instance.oc1.phx.<unique_ID>\”,\“issuer\”:\“h\”]}" ], "Accept": [ "application/json" ], "X-Oracle-Auth-Client-CN": [ "splat-proxy-se-02302.node.ad2.r2" ], "X-Forwarded-Host": [ "compute-api.svc.ad1.r2" ], "Connection": [ "close" ], "User-Agent": [ "Jersey/2.23 (HttpUrlConnection 1.8.0_212)" ], "X-Forwarded-For": [ "172.24.80.88" ], "X-Real-IP": [ "172.24.80.88" ], "oci-original-url": [ "iaas.r2.oracleiaas.com/20160918/instances/ocid1.instance.oc1.phx.>" ], "opc-request-id": [ "<unique_ID>" ], "Date": [ "Wed, 18 Sep 2019 00:10:58 UTC" ] } —–

Returns:

  • (Hash<String, Array<String>>)


79
80
81
# File 'lib/oci/audit/models/request.rb', line 79

def headers
  @headers
end

#idString

The opc-request-id of the request.

Returns:

  • (String)


15
16
17
# File 'lib/oci/audit/models/request.rb', line 15

def id
  @id
end

#parametersHash<String, Array<String>>

The parameters supplied by the caller during this operation.

Returns:

  • (Hash<String, Array<String>>)


34
35
36
# File 'lib/oci/audit/models/request.rb', line 34

def parameters
  @parameters
end

#pathString

The full path of the API request.

Example: /20160918/instances/ocid1.instance.oc1.phx.<unique_ID>

Returns:

  • (String)


22
23
24
# File 'lib/oci/audit/models/request.rb', line 22

def path
  @path
end

Class Method Details

.attribute_mapObject

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



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/oci/audit/models/request.rb', line 82

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'path': :'path',
    'action': :'action',
    'parameters': :'parameters',
    'headers': :'headers'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



95
96
97
98
99
100
101
102
103
104
105
# File 'lib/oci/audit/models/request.rb', line 95

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'path': :'String',
    'action': :'String',
    'parameters': :'Hash<String, Array<String>>',
    'headers': :'Hash<String, Array<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



142
143
144
145
146
147
148
149
150
151
# File 'lib/oci/audit/models/request.rb', line 142

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

  self.class == other.class &&
    id == other.id &&
    path == other.path &&
    action == other.action &&
    parameters == other.parameters &&
    headers == other.headers
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



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/oci/audit/models/request.rb', line 176

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


156
157
158
# File 'lib/oci/audit/models/request.rb', line 156

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



165
166
167
# File 'lib/oci/audit/models/request.rb', line 165

def hash
  [id, path, action, parameters, headers].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



209
210
211
212
213
214
215
216
217
218
# File 'lib/oci/audit/models/request.rb', line 209

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



203
204
205
# File 'lib/oci/audit/models/request.rb', line 203

def to_s
  to_hash.to_s
end