Class: Seahorse::Client::RequestContext

Inherits:
Object
  • Object
show all
Defined in:
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.

Options Hash (options):

  • :operation_name (required, Symbol) — default: nil
  • :operation (required, Model::Operation) — default: nil
  • :authorizer (Model::Authorizer) — default: nil
  • :client (Client) — 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
  • :retries (Integer) — default: 0
  • :tracer (Aws::Telemetry::TracerBase) — default: Aws::Telemetry::NoOpTracer.new
  • :metadata (Hash) — default: {}


20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/seahorse/client/request_context.rb', line 20

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
  @tracer = options[:tracer] || Aws::Telemetry::NoOpTracer.new
   = {}
end

Instance Attribute Details

#authorizerModel::Authorizer



41
42
43
# File 'lib/seahorse/client/request_context.rb', line 41

def authorizer
  @authorizer
end

#clientSeahorse::Client::Base



44
45
46
# File 'lib/seahorse/client/request_context.rb', line 44

def client
  @client
end

#configConfiguration



50
51
52
# File 'lib/seahorse/client/request_context.rb', line 50

def config
  @config
end

#http_requestHttp::Request



53
54
55
# File 'lib/seahorse/client/request_context.rb', line 53

def http_request
  @http_request
end

#http_responseHttp::Response



56
57
58
# File 'lib/seahorse/client/request_context.rb', line 56

def http_response
  @http_response
end

#metadataHash (readonly)



65
66
67
# File 'lib/seahorse/client/request_context.rb', line 65

def 
  
end

#operationModel::Operation



38
39
40
# File 'lib/seahorse/client/request_context.rb', line 38

def operation
  @operation
end

#operation_nameSymbol



35
36
37
# File 'lib/seahorse/client/request_context.rb', line 35

def operation_name
  @operation_name
end

#paramsHash



47
48
49
# File 'lib/seahorse/client/request_context.rb', line 47

def params
  @params
end

#retriesInteger



59
60
61
# File 'lib/seahorse/client/request_context.rb', line 59

def retries
  @retries
end

#tracerTracer



62
63
64
# File 'lib/seahorse/client/request_context.rb', line 62

def tracer
  @tracer
end

Instance Method Details

#[](key) ⇒ Object

Returns the metadata for the given key.



70
71
72
# File 'lib/seahorse/client/request_context.rb', line 70

def [](key)
  [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.



79
80
81
# File 'lib/seahorse/client/request_context.rb', line 79

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