AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Class: Seahorse::Client::RequestContext

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-core/lib/seahorse/client/request_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RequestContext

Returns a new instance of RequestContext.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :operation_name (required, Symbol) — default: nil
  • :operation (required, Model::Operation) — default: nil
  • :authorizer (Model::Authorizer) — default: nil
  • :params (Hash) — default: {}
  • :config (Configuration) — default: nil
  • :http_request (Http::Request) — default: Http::Request.new
  • :http_response (Http::Response) — default: Http::Response.new

    and #rewind.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 17

def initialize(options = {})
  @operation_name = options[:operation_name]
  @operation = options[:operation]
  @authorizer = options[:authorizer]
  @client = options[:client]
  @params = options[:params] || {}
  @config = options[:config]
  @http_request = options[:http_request] || Http::Request.new
  @http_response = options[:http_response] || Http::Response.new
  @retries = 0
  @metadata = {}
end

Instance Attribute Details

#authorizerModel::Authorizer

Returns APIG SDKs only.

Returns:



37
38
39
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 37

def authorizer
  @authorizer
end

#clientSeahorse::Client::Base



40
41
42
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 40

def client
  @client
end

#configConfiguration

Returns The client configuration.

Returns:



46
47
48
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 46

def config
  @config
end

#http_requestHttp::Request

Returns:



49
50
51
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 49

def http_request
  @http_request
end

#http_responseHttp::Response

Returns:



52
53
54
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 52

def http_response
  @http_response
end

#metadataHash (readonly)

Returns:

  • (Hash)


58
59
60
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 58

def 
  @metadata
end

#operationModel::Operation

Returns:



34
35
36
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 34

def operation
  @operation
end

#operation_nameSymbol

Returns Name of the API operation called.

Returns:

  • (Symbol)

    Name of the API operation called.



31
32
33
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 31

def operation_name
  @operation_name
end

#paramsHash

Returns The hash of request parameters.

Returns:

  • (Hash)

    The hash of request parameters.



43
44
45
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 43

def params
  @params
end

#retriesInteger

Returns:

  • (Integer)


55
56
57
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 55

def retries
  @retries
end

Instance Method Details

#[](key) ⇒ Object

Returns the metadata for the given key.

Parameters:

  • key (Symbol)

Returns:

  • (Object)


63
64
65
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 63

def [](key)
  @metadata[key]
end

#[]=(key, value) ⇒ Object

Sets the request context metadata for the given key. Request metadata useful for handlers that need to keep state on the request, without sending that data with the request over HTTP.

Parameters:

  • key (Symbol)
  • value (Object)


72
73
74
# File 'gems/aws-sdk-core/lib/seahorse/client/request_context.rb', line 72

def []=(key, value)
  @metadata[key] = value
end