aws-sdk-core 3.181.0 → 3.209.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +413 -0
- data/VERSION +1 -1
- data/lib/aws-defaults.rb +4 -1
- data/lib/aws-sdk-core/assume_role_credentials.rb +12 -5
- data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +13 -7
- data/lib/aws-sdk-core/binary/decode_handler.rb +3 -9
- data/lib/aws-sdk-core/binary/encode_handler.rb +1 -1
- data/lib/aws-sdk-core/binary/event_builder.rb +34 -37
- data/lib/aws-sdk-core/binary/event_stream_decoder.rb +1 -0
- data/lib/aws-sdk-core/binary/event_stream_encoder.rb +4 -3
- data/lib/aws-sdk-core/cbor/cbor_engine.rb +19 -0
- data/lib/aws-sdk-core/cbor/decoder.rb +310 -0
- data/lib/aws-sdk-core/cbor/encoder.rb +243 -0
- data/lib/aws-sdk-core/cbor.rb +106 -0
- data/lib/aws-sdk-core/client_side_monitoring.rb +9 -0
- data/lib/aws-sdk-core/client_stubs.rb +18 -14
- data/lib/aws-sdk-core/credential_provider.rb +1 -1
- data/lib/aws-sdk-core/credential_provider_chain.rb +13 -6
- data/lib/aws-sdk-core/credentials.rb +13 -6
- data/lib/aws-sdk-core/ec2_metadata.rb +1 -1
- data/lib/aws-sdk-core/ecs_credentials.rb +78 -11
- data/lib/aws-sdk-core/endpoints/endpoint.rb +3 -1
- data/lib/aws-sdk-core/endpoints/matchers.rb +18 -10
- data/lib/aws-sdk-core/endpoints.rb +74 -18
- data/lib/aws-sdk-core/error_handler.rb +41 -0
- data/lib/aws-sdk-core/errors.rb +12 -3
- data/lib/aws-sdk-core/event_emitter.rb +0 -16
- data/lib/aws-sdk-core/instance_profile_credentials.rb +55 -32
- data/lib/aws-sdk-core/json/builder.rb +8 -1
- data/lib/aws-sdk-core/json/error_handler.rb +15 -10
- data/lib/aws-sdk-core/json/handler.rb +12 -6
- data/lib/aws-sdk-core/json/json_engine.rb +3 -1
- data/lib/aws-sdk-core/json/oj_engine.rb +7 -1
- data/lib/aws-sdk-core/json/parser.rb +33 -3
- data/lib/aws-sdk-core/json.rb +43 -14
- data/lib/aws-sdk-core/log/param_filter.rb +2 -2
- data/lib/aws-sdk-core/log.rb +10 -0
- data/lib/aws-sdk-core/lru_cache.rb +75 -0
- data/lib/aws-sdk-core/pageable_response.rb +1 -1
- data/lib/aws-sdk-core/param_validator.rb +9 -4
- data/lib/aws-sdk-core/plugins/bearer_authorization.rb +2 -0
- data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +6 -3
- data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +1 -0
- data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +14 -2
- data/lib/aws-sdk-core/plugins/credentials_configuration.rb +9 -3
- data/lib/aws-sdk-core/plugins/global_configuration.rb +8 -9
- data/lib/aws-sdk-core/plugins/http_checksum.rb +2 -1
- data/lib/aws-sdk-core/plugins/invocation_id.rb +1 -11
- data/lib/aws-sdk-core/plugins/logging.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/api_gateway.rb +3 -1
- data/lib/aws-sdk-core/plugins/protocols/ec2.rb +2 -24
- data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +6 -8
- data/lib/aws-sdk-core/plugins/protocols/query.rb +4 -2
- data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +3 -15
- data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +3 -0
- data/lib/aws-sdk-core/plugins/protocols/rpc_v2.rb +17 -0
- data/lib/aws-sdk-core/plugins/regional_endpoint.rb +33 -3
- data/lib/aws-sdk-core/plugins/request_compression.rb +11 -2
- data/lib/aws-sdk-core/plugins/retry_errors.rb +12 -3
- data/lib/aws-sdk-core/plugins/sign.rb +27 -15
- data/lib/aws-sdk-core/plugins/signature_v2.rb +2 -1
- data/lib/aws-sdk-core/plugins/signature_v4.rb +2 -1
- data/lib/aws-sdk-core/plugins/stub_responses.rb +30 -2
- data/lib/aws-sdk-core/plugins/telemetry.rb +75 -0
- data/lib/aws-sdk-core/plugins/transfer_encoding.rb +16 -9
- data/lib/aws-sdk-core/plugins/user_agent.rb +70 -26
- data/lib/aws-sdk-core/plugins.rb +39 -0
- data/lib/aws-sdk-core/process_credentials.rb +47 -28
- data/lib/aws-sdk-core/query/ec2_handler.rb +27 -0
- data/lib/aws-sdk-core/query/ec2_param_builder.rb +5 -7
- data/lib/aws-sdk-core/query/handler.rb +4 -4
- data/lib/aws-sdk-core/query/param_builder.rb +2 -2
- data/lib/aws-sdk-core/query.rb +2 -1
- data/lib/aws-sdk-core/refreshing_credentials.rb +12 -6
- data/lib/aws-sdk-core/resources.rb +8 -0
- data/lib/aws-sdk-core/rest/content_type_handler.rb +60 -0
- data/lib/aws-sdk-core/rest/handler.rb +3 -4
- data/lib/aws-sdk-core/rest/request/body.rb +32 -5
- data/lib/aws-sdk-core/rest/request/endpoint.rb +24 -4
- data/lib/aws-sdk-core/rest/request/headers.rb +15 -7
- data/lib/aws-sdk-core/rest/request/querystring_builder.rb +62 -36
- data/lib/aws-sdk-core/rest/response/body.rb +15 -1
- data/lib/aws-sdk-core/rest/response/header_list_parser.rb +79 -0
- data/lib/aws-sdk-core/rest/response/headers.rb +8 -3
- data/lib/aws-sdk-core/rest.rb +1 -0
- data/lib/aws-sdk-core/rpc_v2/builder.rb +62 -0
- data/lib/aws-sdk-core/rpc_v2/content_type_handler.rb +45 -0
- data/lib/aws-sdk-core/rpc_v2/error_handler.rb +84 -0
- data/lib/aws-sdk-core/rpc_v2/handler.rb +78 -0
- data/lib/aws-sdk-core/rpc_v2/parser.rb +90 -0
- data/lib/aws-sdk-core/rpc_v2.rb +6 -0
- data/lib/aws-sdk-core/shared_config.rb +7 -2
- data/lib/aws-sdk-core/shared_credentials.rb +0 -7
- data/lib/aws-sdk-core/sso_credentials.rb +2 -1
- data/lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb +41 -0
- data/lib/aws-sdk-core/stubbing.rb +22 -0
- data/lib/aws-sdk-core/telemetry/base.rb +177 -0
- data/lib/aws-sdk-core/telemetry/no_op.rb +70 -0
- data/lib/aws-sdk-core/telemetry/otel.rb +235 -0
- data/lib/aws-sdk-core/telemetry/span_kind.rb +22 -0
- data/lib/aws-sdk-core/telemetry/span_status.rb +59 -0
- data/lib/aws-sdk-core/telemetry.rb +78 -0
- data/lib/aws-sdk-core/util.rb +39 -0
- data/lib/aws-sdk-core/waiters/poller.rb +10 -5
- data/lib/aws-sdk-core/xml/builder.rb +17 -9
- data/lib/aws-sdk-core/xml/error_handler.rb +32 -42
- data/lib/aws-sdk-core/xml/parser/frame.rb +4 -20
- data/lib/aws-sdk-core/xml/parser/stack.rb +2 -0
- data/lib/aws-sdk-core/xml/parser.rb +2 -6
- data/lib/aws-sdk-core.rb +82 -107
- data/lib/aws-sdk-sso/client.rb +119 -55
- data/lib/aws-sdk-sso/client_api.rb +7 -0
- data/lib/aws-sdk-sso/endpoint_provider.rb +30 -24
- data/lib/aws-sdk-sso/endpoints.rb +4 -16
- data/lib/aws-sdk-sso/plugins/endpoints.rb +22 -8
- data/lib/aws-sdk-sso/types.rb +1 -0
- data/lib/aws-sdk-sso.rb +15 -11
- data/lib/aws-sdk-ssooidc/client.rb +504 -83
- data/lib/aws-sdk-ssooidc/client_api.rb +83 -1
- data/lib/aws-sdk-ssooidc/endpoint_provider.rb +30 -24
- data/lib/aws-sdk-ssooidc/endpoints.rb +14 -12
- data/lib/aws-sdk-ssooidc/errors.rb +52 -0
- data/lib/aws-sdk-ssooidc/plugins/endpoints.rb +24 -8
- data/lib/aws-sdk-ssooidc/types.rb +373 -51
- data/lib/aws-sdk-ssooidc.rb +15 -11
- data/lib/aws-sdk-sts/client.rb +129 -57
- data/lib/aws-sdk-sts/client_api.rb +15 -11
- data/lib/aws-sdk-sts/customizations.rb +5 -1
- data/lib/aws-sdk-sts/endpoint_provider.rb +2 -2
- data/lib/aws-sdk-sts/endpoints.rb +8 -32
- data/lib/aws-sdk-sts/plugins/endpoints.rb +22 -8
- data/lib/aws-sdk-sts/presigner.rb +1 -1
- data/lib/aws-sdk-sts/types.rb +19 -4
- data/lib/aws-sdk-sts.rb +15 -11
- data/lib/seahorse/client/async_base.rb +1 -1
- data/lib/seahorse/client/async_response.rb +19 -0
- data/lib/seahorse/client/base.rb +18 -7
- data/lib/seahorse/client/h2/handler.rb +14 -3
- data/lib/seahorse/client/handler.rb +1 -1
- data/lib/seahorse/client/net_http/connection_pool.rb +11 -11
- data/lib/seahorse/client/net_http/handler.rb +21 -9
- data/lib/seahorse/client/net_http/patches.rb +1 -4
- data/lib/seahorse/client/plugin.rb +9 -0
- data/lib/seahorse/client/plugins/endpoint.rb +0 -1
- data/lib/seahorse/client/plugins/h2.rb +3 -3
- data/lib/seahorse/client/plugins/net_http.rb +57 -16
- data/lib/seahorse/client/request_context.rb +8 -1
- data/lib/seahorse/model/shapes.rb +2 -2
- data/sig/aws-sdk-core/client_stubs.rbs +10 -0
- data/sig/aws-sdk-core/errors.rbs +22 -0
- data/sig/aws-sdk-core/resources/collection.rbs +21 -0
- data/sig/aws-sdk-core/structure.rbs +4 -0
- data/sig/aws-sdk-core/telemetry/base.rbs +46 -0
- data/sig/aws-sdk-core/telemetry/otel.rbs +22 -0
- data/sig/aws-sdk-core/telemetry/span_kind.rbs +15 -0
- data/sig/aws-sdk-core/telemetry/span_status.rbs +24 -0
- data/sig/aws-sdk-core/waiters/errors.rbs +20 -0
- data/sig/aws-sdk-core.rbs +7 -0
- data/sig/seahorse/client/base.rbs +25 -0
- data/sig/seahorse/client/handler_builder.rbs +16 -0
- data/sig/seahorse/client/response.rbs +61 -0
- metadata +59 -17
- /data/lib/aws-sdk-core/xml/parser/{engines/libxml.rb → libxml_engine.rb} +0 -0
- /data/lib/aws-sdk-core/xml/parser/{engines/nokogiri.rb → nokogiri_engine.rb} +0 -0
- /data/lib/aws-sdk-core/xml/parser/{engines/oga.rb → oga_engine.rb} +0 -0
- /data/lib/aws-sdk-core/xml/parser/{engines/ox.rb → ox_engine.rb} +0 -0
- /data/lib/aws-sdk-core/xml/parser/{engines/rexml.rb → rexml_engine.rb} +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module RpcV2
|
|
5
|
+
class ErrorHandler < Aws::ErrorHandler
|
|
6
|
+
|
|
7
|
+
def call(context)
|
|
8
|
+
# Malformed responses should throw an http based error, so we check
|
|
9
|
+
# 200 range for error handling only for this case.
|
|
10
|
+
@handler.call(context).on(200..599) do |response|
|
|
11
|
+
if !valid_response?(context)
|
|
12
|
+
code, message, data = http_status_error(context)
|
|
13
|
+
response.error = build_error(context, code, message, data)
|
|
14
|
+
elsif (300..599).cover?(context.http_response.status_code)
|
|
15
|
+
response.error = error(context)
|
|
16
|
+
end
|
|
17
|
+
response.data = nil
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def valid_response?(context)
|
|
24
|
+
req_header = context.http_request.headers['smithy-protocol']
|
|
25
|
+
resp_header = context.http_response.headers['smithy-protocol']
|
|
26
|
+
req_header == resp_header
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def extract_error(body, context)
|
|
30
|
+
data = Cbor.decode(body)
|
|
31
|
+
code = error_code(data, context)
|
|
32
|
+
message = data['message']
|
|
33
|
+
data = parse_error_data(context, body, code)
|
|
34
|
+
[code, message, data]
|
|
35
|
+
rescue Cbor::Error
|
|
36
|
+
[http_status_error_code(context), '', EmptyStructure.new]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def error_code(data, context)
|
|
40
|
+
code =
|
|
41
|
+
if aws_query_error?(context)
|
|
42
|
+
error = context.http_response.headers['x-amzn-query-error'].split(';')[0]
|
|
43
|
+
remove_prefix(error, context)
|
|
44
|
+
else
|
|
45
|
+
data['__type']
|
|
46
|
+
end
|
|
47
|
+
if code
|
|
48
|
+
code.split('#').last
|
|
49
|
+
else
|
|
50
|
+
http_status_error_code(context)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def parse_error_data(context, body, code)
|
|
55
|
+
data = EmptyStructure.new
|
|
56
|
+
if (error_rules = context.operation.errors)
|
|
57
|
+
error_rules.each do |rule|
|
|
58
|
+
# match modeled shape name with the type(code) only
|
|
59
|
+
# some type(code) might contains invalid characters
|
|
60
|
+
# such as ':' (efs) etc
|
|
61
|
+
match = rule.shape.name == code.gsub(/[^^a-zA-Z0-9]/, '')
|
|
62
|
+
next unless match && rule.shape.members.any?
|
|
63
|
+
|
|
64
|
+
data = Parser.new(rule).parse(body)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
data
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def aws_query_error?(context)
|
|
71
|
+
context.config.api.metadata['awsQueryCompatible'] &&
|
|
72
|
+
context.http_response.headers['x-amzn-query-error']
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def remove_prefix(error_code, context)
|
|
76
|
+
if (prefix = context.config.api.metadata['errorPrefix'])
|
|
77
|
+
error_code.sub(/^#{prefix}/, '')
|
|
78
|
+
else
|
|
79
|
+
error_code
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module RpcV2
|
|
5
|
+
class Handler < Seahorse::Client::Handler
|
|
6
|
+
# @param [Seahorse::Client::RequestContext] context
|
|
7
|
+
# @return [Seahorse::Client::Response]
|
|
8
|
+
def call(context)
|
|
9
|
+
build_request(context)
|
|
10
|
+
response = with_metric { @handler.call(context) }
|
|
11
|
+
response.on(200..299) { |resp| resp.data = parse_body(context) }
|
|
12
|
+
response.on(200..599) { |_resp| apply_request_id(context) }
|
|
13
|
+
response
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def with_metric(&block)
|
|
19
|
+
Aws::Plugins::UserAgent.metric('PROTOCOL_RPC_V2_CBOR', &block)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def build_request(context)
|
|
23
|
+
context.http_request.headers['smithy-protocol'] = 'rpc-v2-cbor'
|
|
24
|
+
context.http_request.http_method = 'POST'
|
|
25
|
+
context.http_request.body = build_body(context)
|
|
26
|
+
build_url(context)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def build_url(context)
|
|
30
|
+
base = context.http_request.endpoint
|
|
31
|
+
service_name = context.config.api.metadata['targetPrefix']
|
|
32
|
+
base.path += "/service/#{service_name}/operation/#{context.operation.name}"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def build_body(context)
|
|
36
|
+
Builder.new(context.operation.input).serialize(context.params)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def parse_body(context)
|
|
40
|
+
cbor = context.http_response.body_contents
|
|
41
|
+
if (rules = context.operation.output)
|
|
42
|
+
if cbor.is_a?(Array)
|
|
43
|
+
# an array of emitted events
|
|
44
|
+
if cbor[0].respond_to?(:response)
|
|
45
|
+
# initial response exists
|
|
46
|
+
# it must be the first event arrived
|
|
47
|
+
resp_struct = cbor.shift.response
|
|
48
|
+
else
|
|
49
|
+
resp_struct = context.operation.output.shape.struct_class.new
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
rules.shape.members.each do |name, ref|
|
|
53
|
+
if ref.eventstream
|
|
54
|
+
resp_struct.send("#{name}=", cbor.to_enum)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
resp_struct
|
|
58
|
+
else
|
|
59
|
+
Parser.new(
|
|
60
|
+
rules,
|
|
61
|
+
query_compatible: query_compatible?(context)
|
|
62
|
+
).parse(cbor)
|
|
63
|
+
end
|
|
64
|
+
else
|
|
65
|
+
EmptyStructure.new
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def apply_request_id(context)
|
|
70
|
+
context[:request_id] = context.http_response.headers['x-amzn-requestid']
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def query_compatible?(context)
|
|
74
|
+
context.config.api.metadata.key?('awsQueryCompatible')
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'time'
|
|
4
|
+
|
|
5
|
+
module Aws
|
|
6
|
+
module RpcV2
|
|
7
|
+
class Parser
|
|
8
|
+
include Seahorse::Model::Shapes
|
|
9
|
+
|
|
10
|
+
# @param [Seahorse::Model::ShapeRef] rules
|
|
11
|
+
def initialize(rules, query_compatible: false)
|
|
12
|
+
@rules = rules
|
|
13
|
+
@query_compatible = query_compatible
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def parse(cbor, target = nil)
|
|
17
|
+
return {} if cbor.empty?
|
|
18
|
+
|
|
19
|
+
parse_ref(@rules, Cbor.decode(cbor), target)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def structure(ref, values, target = nil)
|
|
25
|
+
shape = ref.shape
|
|
26
|
+
target = ref.shape.struct_class.new if target.nil?
|
|
27
|
+
values.each do |key, value|
|
|
28
|
+
member_name, member_ref = shape.member_by_location_name(key)
|
|
29
|
+
if member_ref
|
|
30
|
+
target[member_name] = parse_ref(member_ref, value)
|
|
31
|
+
elsif shape.union && key != '__type'
|
|
32
|
+
target[:unknown] = { 'name' => key, 'value' => value }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
# In services that were previously Query/XML, members that were
|
|
36
|
+
# "flattened" defaulted to empty lists. In JSON, these values are nil,
|
|
37
|
+
# which is backwards incompatible. To preserve backwards compatibility,
|
|
38
|
+
# we set a default value of [] for these members.
|
|
39
|
+
if @query_compatible
|
|
40
|
+
ref.shape.members.each do |member_name, member_target|
|
|
41
|
+
next unless target[member_name].nil?
|
|
42
|
+
|
|
43
|
+
if flattened_list?(member_target.shape)
|
|
44
|
+
target[member_name] = []
|
|
45
|
+
elsif flattened_map?(member_target.shape)
|
|
46
|
+
target[member_name] = {}
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
if shape.union
|
|
52
|
+
# convert to subclass
|
|
53
|
+
member_subclass = shape.member_subclass(target.member).new
|
|
54
|
+
member_subclass[target.member] = target.value
|
|
55
|
+
target = member_subclass
|
|
56
|
+
end
|
|
57
|
+
target
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def list(ref, values, target = nil)
|
|
61
|
+
target = [] if target.nil?
|
|
62
|
+
values.each do |value|
|
|
63
|
+
target << parse_ref(ref.shape.member, value)
|
|
64
|
+
end
|
|
65
|
+
target
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def map(ref, values, target = nil)
|
|
69
|
+
target = {} if target.nil?
|
|
70
|
+
values.each do |key, value|
|
|
71
|
+
target[key] = parse_ref(ref.shape.value, value) unless value.nil?
|
|
72
|
+
end
|
|
73
|
+
target
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def parse_ref(ref, value, target = nil)
|
|
77
|
+
if value.nil?
|
|
78
|
+
nil
|
|
79
|
+
else
|
|
80
|
+
case ref.shape
|
|
81
|
+
when StructureShape then structure(ref, value, target)
|
|
82
|
+
when ListShape then list(ref, value, target)
|
|
83
|
+
when MapShape then map(ref, value, target)
|
|
84
|
+
else value
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -198,6 +198,8 @@ module Aws
|
|
|
198
198
|
|
|
199
199
|
config_reader(
|
|
200
200
|
:region,
|
|
201
|
+
:account_id_endpoint_mode,
|
|
202
|
+
:sigv4a_signing_region_set,
|
|
201
203
|
:ca_bundle,
|
|
202
204
|
:credential_process,
|
|
203
205
|
:endpoint_discovery_enabled,
|
|
@@ -205,6 +207,7 @@ module Aws
|
|
|
205
207
|
:use_fips_endpoint,
|
|
206
208
|
:ec2_metadata_service_endpoint,
|
|
207
209
|
:ec2_metadata_service_endpoint_mode,
|
|
210
|
+
:ec2_metadata_v1_disabled,
|
|
208
211
|
:max_attempts,
|
|
209
212
|
:retry_mode,
|
|
210
213
|
:adaptive_retry_wait_to_fill,
|
|
@@ -217,6 +220,7 @@ module Aws
|
|
|
217
220
|
:s3_use_arn_region,
|
|
218
221
|
:s3_us_east_1_regional_endpoint,
|
|
219
222
|
:s3_disable_multiregion_access_points,
|
|
223
|
+
:s3_disable_express_session_auth,
|
|
220
224
|
:defaults_mode,
|
|
221
225
|
:sdk_ua_app_id,
|
|
222
226
|
:disable_request_compression,
|
|
@@ -336,7 +340,7 @@ module Aws
|
|
|
336
340
|
if @parsed_config
|
|
337
341
|
credential_process ||= @parsed_config.fetch(profile, {})['credential_process']
|
|
338
342
|
end
|
|
339
|
-
ProcessCredentials.new(credential_process) if credential_process
|
|
343
|
+
ProcessCredentials.new([credential_process]) if credential_process
|
|
340
344
|
end
|
|
341
345
|
|
|
342
346
|
def credentials_from_shared(profile, _opts)
|
|
@@ -411,7 +415,8 @@ module Aws
|
|
|
411
415
|
creds = Credentials.new(
|
|
412
416
|
prof_config['aws_access_key_id'],
|
|
413
417
|
prof_config['aws_secret_access_key'],
|
|
414
|
-
prof_config['aws_session_token']
|
|
418
|
+
prof_config['aws_session_token'],
|
|
419
|
+
account_id: prof_config['aws_account_id']
|
|
415
420
|
)
|
|
416
421
|
creds if creds.set?
|
|
417
422
|
end
|
|
@@ -7,13 +7,6 @@ module Aws
|
|
|
7
7
|
|
|
8
8
|
include CredentialProvider
|
|
9
9
|
|
|
10
|
-
# @api private
|
|
11
|
-
KEY_MAP = {
|
|
12
|
-
'aws_access_key_id' => 'access_key_id',
|
|
13
|
-
'aws_secret_access_key' => 'secret_access_key',
|
|
14
|
-
'aws_session_token' => 'session_token',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
10
|
# Constructs a new SharedCredentials object. This will load static
|
|
18
11
|
# (access_key_id, secret_access_key and session_token) AWS access
|
|
19
12
|
# credentials from an ini file, which supports profiles. The default
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Stubbing
|
|
5
|
+
module Protocols
|
|
6
|
+
class RpcV2
|
|
7
|
+
|
|
8
|
+
def stub_data(api, operation, data)
|
|
9
|
+
resp = Seahorse::Client::Http::Response.new
|
|
10
|
+
resp.status_code = 200
|
|
11
|
+
resp.headers['Content-Type'] = content_type(api)
|
|
12
|
+
resp.headers['x-amzn-RequestId'] = 'stubbed-request-id'
|
|
13
|
+
resp.body = build_body(operation, data)
|
|
14
|
+
resp
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def stub_error(error_code)
|
|
18
|
+
http_resp = Seahorse::Client::Http::Response.new
|
|
19
|
+
http_resp.status_code = 400
|
|
20
|
+
http_resp.body = <<-JSON.strip
|
|
21
|
+
{
|
|
22
|
+
"code": #{error_code.inspect},
|
|
23
|
+
"message": "stubbed-response-error-message"
|
|
24
|
+
}
|
|
25
|
+
JSON
|
|
26
|
+
http_resp
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def content_type(api)
|
|
32
|
+
'application/cbor'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def build_body(operation, data)
|
|
36
|
+
Aws::RpcV2::Builder.new(operation.output).serialize(data)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
# setup autoloading for Stubbing module
|
|
5
|
+
module Stubbing
|
|
6
|
+
autoload :EmptyStub, 'aws-sdk-core/stubbing/empty_stub'
|
|
7
|
+
autoload :DataApplicator, 'aws-sdk-core/stubbing/data_applicator'
|
|
8
|
+
autoload :StubData, 'aws-sdk-core/stubbing/stub_data'
|
|
9
|
+
autoload :XmlError, 'aws-sdk-core/stubbing/xml_error'
|
|
10
|
+
|
|
11
|
+
module Protocols
|
|
12
|
+
autoload :Json, 'aws-sdk-core/stubbing/protocols/json'
|
|
13
|
+
autoload :Rest, 'aws-sdk-core/stubbing/protocols/rest'
|
|
14
|
+
autoload :RestJson, 'aws-sdk-core/stubbing/protocols/rest_json'
|
|
15
|
+
autoload :RestXml, 'aws-sdk-core/stubbing/protocols/rest_xml'
|
|
16
|
+
autoload :Query, 'aws-sdk-core/stubbing/protocols/query'
|
|
17
|
+
autoload :EC2, 'aws-sdk-core/stubbing/protocols/ec2'
|
|
18
|
+
autoload :RpcV2, 'aws-sdk-core/stubbing/protocols/rpc_v2'
|
|
19
|
+
autoload :ApiGateway, 'aws-sdk-core/stubbing/protocols/api_gateway'
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Telemetry
|
|
5
|
+
# Base for `TelemetryProvider` classes.
|
|
6
|
+
# They are used to emit telemetry data. It needs the
|
|
7
|
+
# following class implementations to function:
|
|
8
|
+
# * {TracerProviderBase} - A provider that returns a tracer
|
|
9
|
+
# instance. Then, a tracer will create spans and those
|
|
10
|
+
# spans will contain information in that given moment.
|
|
11
|
+
# * {ContextManagerBase} - Manages context and used to
|
|
12
|
+
# return the current context within a trace.
|
|
13
|
+
class TelemetryProviderBase
|
|
14
|
+
# @param [Aws::Telemetry::TracerBase] tracer_provider A provider
|
|
15
|
+
# that returns a tracer instance.
|
|
16
|
+
# @param [Aws::Telemetry::ContextManagerBase] context_manager Manages
|
|
17
|
+
# context and used to return the current context.
|
|
18
|
+
def initialize(tracer_provider: nil, context_manager: nil)
|
|
19
|
+
@tracer_provider = tracer_provider
|
|
20
|
+
@context_manager = context_manager
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# @return [Aws::Telemetry::TracerProviderBase]
|
|
24
|
+
attr_reader :tracer_provider
|
|
25
|
+
|
|
26
|
+
# @return [Aws::Telemetry::ContextManagerBase]
|
|
27
|
+
attr_reader :context_manager
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Base for `TracerProvider` classes.
|
|
31
|
+
class TracerProviderBase
|
|
32
|
+
# Returns a Tracer instance.
|
|
33
|
+
#
|
|
34
|
+
# @param [String] name Tracer name
|
|
35
|
+
# @return [Aws::Telemetry::TracerBase]
|
|
36
|
+
def tracer(name = nil)
|
|
37
|
+
raise NotImplementedError
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Base for `Tracer` classes.
|
|
42
|
+
class TracerBase
|
|
43
|
+
# Used when a caller wants to manage the activation/deactivation and
|
|
44
|
+
# lifecycle of the Span and its parent manually.
|
|
45
|
+
#
|
|
46
|
+
# @param [String] name Span name
|
|
47
|
+
# @param [Object] with_parent Parent Context
|
|
48
|
+
# @param [Hash] attributes Attributes to attach to the span
|
|
49
|
+
# @param [Aws::Telemetry::SpanKind] kind Type of Span
|
|
50
|
+
# @return [Aws::Telemetry::SpanBase]
|
|
51
|
+
def start_span(name, with_parent: nil, attributes: nil, kind: nil)
|
|
52
|
+
raise NotImplementedError
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# A helper for the default use-case of extending the current trace
|
|
56
|
+
# with a span.
|
|
57
|
+
# On exit, the Span that was active before calling this method will
|
|
58
|
+
# be reactivated. If an exception occurs during the execution of the
|
|
59
|
+
# provided block, it will be recorded on the span and re-raised.
|
|
60
|
+
#
|
|
61
|
+
# @param [String] name Span name
|
|
62
|
+
# @param [Hash] attributes Attributes to attach to the span
|
|
63
|
+
# @param [Aws::Telemetry::SpanKind] kind Type of Span
|
|
64
|
+
# @return [Aws::Telemetry::SpanBase]
|
|
65
|
+
def in_span(name, attributes: nil, kind: nil)
|
|
66
|
+
raise NotImplementedError
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Returns the current active span.
|
|
70
|
+
#
|
|
71
|
+
# @return [Aws::Telemetry::SpanBase]
|
|
72
|
+
def current_span
|
|
73
|
+
raise NotImplementedError
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Base for `Span` classes.
|
|
78
|
+
class SpanBase
|
|
79
|
+
# Set attribute.
|
|
80
|
+
#
|
|
81
|
+
# @param [String] key
|
|
82
|
+
# @param [String, Boolean, Numeric, Array<String, Numeric, Boolean>] value
|
|
83
|
+
# Value must be non-nil and (array of) string, boolean or numeric type.
|
|
84
|
+
# Array values must not contain nil elements and all elements must be of
|
|
85
|
+
# the same basic type (string, numeric, boolean)
|
|
86
|
+
# @return [self] returns itself
|
|
87
|
+
def set_attribute(key, value)
|
|
88
|
+
raise NotImplementedError
|
|
89
|
+
end
|
|
90
|
+
alias []= set_attribute
|
|
91
|
+
|
|
92
|
+
# Add attributes.
|
|
93
|
+
#
|
|
94
|
+
# @param [Hash{String => String, Numeric, Boolean, Array<String, Numeric,
|
|
95
|
+
# Boolean>}] attributes Values must be non-nil and (array of) string,
|
|
96
|
+
# boolean or numeric type. Array values must not contain nil elements
|
|
97
|
+
# and all elements must be of the same basic type (string, numeric,
|
|
98
|
+
# boolean)
|
|
99
|
+
# @return [self] returns itself
|
|
100
|
+
def add_attributes(attributes)
|
|
101
|
+
raise NotImplementedError
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Add event to a Span.
|
|
105
|
+
#
|
|
106
|
+
# @param [String] name Name of the event
|
|
107
|
+
# @param [Hash{String => String, Numeric, Boolean, Array<String,
|
|
108
|
+
# Numeric, Boolean>}] attributes Values must be non-nil and (array of)
|
|
109
|
+
# string, boolean or numeric type. Array values must not contain nil
|
|
110
|
+
# elements and all elements must be of the same basic type (string,
|
|
111
|
+
# numeric, boolean)
|
|
112
|
+
# @return [self] returns itself
|
|
113
|
+
def add_event(name, attributes: nil)
|
|
114
|
+
raise NotImplementedError
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Sets the Span status.
|
|
118
|
+
#
|
|
119
|
+
# @param [Aws::Telemetry::SpanStatus] status The new status, which
|
|
120
|
+
# overrides the default Span status, which is `OK`
|
|
121
|
+
# @return [void]
|
|
122
|
+
def status=(status)
|
|
123
|
+
raise NotImplementedError
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Finishes the Span.
|
|
127
|
+
#
|
|
128
|
+
# @param [Time] end_timestamp End timestamp for the span.
|
|
129
|
+
# @return [self] returns itself
|
|
130
|
+
def finish(end_timestamp: nil)
|
|
131
|
+
raise NotImplementedError
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Record an exception during the execution of this span. Multiple
|
|
135
|
+
# exceptions can be recorded on a span.
|
|
136
|
+
#
|
|
137
|
+
# @param [Exception] exception The exception to be recorded
|
|
138
|
+
# @param [Hash{String => String, Numeric, Boolean, Array<String,
|
|
139
|
+
# Numeric, Boolean>}] attributes One or more key:value pairs, where the
|
|
140
|
+
# keys must be strings and the values may be (array of) string, boolean
|
|
141
|
+
# or numeric type.
|
|
142
|
+
# @return [void]
|
|
143
|
+
def record_exception(exception, attributes: nil)
|
|
144
|
+
raise NotImplementedError
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Base for all `ContextManager` classes.
|
|
149
|
+
class ContextManagerBase
|
|
150
|
+
# Returns current context.
|
|
151
|
+
#
|
|
152
|
+
# @return [Context]
|
|
153
|
+
def current
|
|
154
|
+
raise NotImplementedError
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Associates a Context with the caller’s current execution unit.
|
|
158
|
+
# Returns a token to be used with the matching call to detach.
|
|
159
|
+
#
|
|
160
|
+
# @param [Object] context The new context
|
|
161
|
+
# @return [Object] token A token to be used when detaching
|
|
162
|
+
def attach(context)
|
|
163
|
+
raise NotImplementedError
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Restore the previous Context associated with the current
|
|
167
|
+
# execution unit to the value it had before attaching a
|
|
168
|
+
# specified Context.
|
|
169
|
+
#
|
|
170
|
+
# @param [Object] token The token provided by matching the call to attach
|
|
171
|
+
# @return [Boolean] `True` if the calls matched, `False` otherwise
|
|
172
|
+
def detach(token)
|
|
173
|
+
raise NotImplementedError
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Telemetry
|
|
5
|
+
# No-op implementation for {TelemetryProviderBase}.
|
|
6
|
+
class NoOpTelemetryProvider < TelemetryProviderBase
|
|
7
|
+
def initialize
|
|
8
|
+
super(
|
|
9
|
+
tracer_provider: NoOpTracerProvider.new,
|
|
10
|
+
context_manager: NoOpContextManager.new
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# No-op implementation for {TracerProviderBase}.
|
|
16
|
+
class NoOpTracerProvider < TracerProviderBase
|
|
17
|
+
def tracer(name = nil)
|
|
18
|
+
@tracer ||= NoOpTracer.new
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# No-op implementation for {TracerBase}.
|
|
23
|
+
class NoOpTracer < TracerBase
|
|
24
|
+
def start_span(name, with_parent: nil, attributes: nil, kind: nil)
|
|
25
|
+
NoOpSpan.new
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def in_span(name, attributes: nil, kind: nil)
|
|
29
|
+
yield NoOpSpan.new
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def current_span
|
|
33
|
+
NoOpSpan.new
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# No-op implementation for {SpanBase}.
|
|
38
|
+
class NoOpSpan < SpanBase
|
|
39
|
+
def set_attribute(key, value)
|
|
40
|
+
self
|
|
41
|
+
end
|
|
42
|
+
alias []= set_attribute
|
|
43
|
+
|
|
44
|
+
def add_attributes(attributes)
|
|
45
|
+
self
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def add_event(name, attributes: nil)
|
|
49
|
+
self
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def status=(status); end
|
|
53
|
+
|
|
54
|
+
def finish(end_timestamp: nil)
|
|
55
|
+
self
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def record_exception(exception, attributes: nil); end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# No-op implementation for {ContextManagerBase}.
|
|
62
|
+
class NoOpContextManager < ContextManagerBase
|
|
63
|
+
def current; end
|
|
64
|
+
|
|
65
|
+
def attach(context); end
|
|
66
|
+
|
|
67
|
+
def detach(token); end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|