aws-sdk-core 3.100.0 → 3.130.0
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 +1294 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -1
- data/lib/aws-defaults/default_configuration.rb +153 -0
- data/lib/aws-defaults/defaults_mode_config_resolver.rb +107 -0
- data/lib/aws-defaults.rb +3 -0
- data/lib/aws-sdk-core/arn.rb +15 -0
- data/lib/aws-sdk-core/arn_parser.rb +2 -0
- data/lib/aws-sdk-core/assume_role_credentials.rb +21 -0
- data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +9 -1
- data/lib/aws-sdk-core/async_client_stubs.rb +2 -0
- data/lib/aws-sdk-core/binary/decode_handler.rb +2 -0
- data/lib/aws-sdk-core/binary/encode_handler.rb +2 -0
- data/lib/aws-sdk-core/binary/event_builder.rb +2 -0
- data/lib/aws-sdk-core/binary/event_parser.rb +2 -0
- data/lib/aws-sdk-core/binary/event_stream_decoder.rb +2 -0
- data/lib/aws-sdk-core/binary/event_stream_encoder.rb +2 -0
- data/lib/aws-sdk-core/binary.rb +2 -0
- data/lib/aws-sdk-core/client_side_monitoring/publisher.rb +2 -0
- data/lib/aws-sdk-core/client_side_monitoring/request_metrics.rb +2 -0
- data/lib/aws-sdk-core/client_stubs.rb +7 -1
- data/lib/aws-sdk-core/credential_provider.rb +2 -0
- data/lib/aws-sdk-core/credential_provider_chain.rb +23 -1
- data/lib/aws-sdk-core/credentials.rb +2 -0
- data/lib/aws-sdk-core/deprecations.rb +2 -0
- data/lib/aws-sdk-core/eager_loader.rb +2 -0
- data/lib/aws-sdk-core/ec2_metadata.rb +238 -0
- data/lib/aws-sdk-core/ecs_credentials.rb +10 -4
- data/lib/aws-sdk-core/endpoint_cache.rb +2 -0
- data/lib/aws-sdk-core/errors.rb +11 -2
- data/lib/aws-sdk-core/event_emitter.rb +2 -0
- data/lib/aws-sdk-core/ini_parser.rb +2 -0
- data/lib/aws-sdk-core/instance_profile_credentials.rb +124 -22
- data/lib/aws-sdk-core/json/builder.rb +2 -0
- data/lib/aws-sdk-core/json/error_handler.rb +2 -0
- data/lib/aws-sdk-core/json/handler.rb +2 -0
- data/lib/aws-sdk-core/json/json_engine.rb +12 -8
- data/lib/aws-sdk-core/json/oj_engine.rb +35 -6
- data/lib/aws-sdk-core/json/parser.rb +10 -0
- data/lib/aws-sdk-core/json.rb +10 -26
- data/lib/aws-sdk-core/log/formatter.rb +9 -3
- data/lib/aws-sdk-core/log/handler.rb +2 -0
- data/lib/aws-sdk-core/log/param_filter.rb +37 -12
- data/lib/aws-sdk-core/log/param_formatter.rb +2 -0
- data/lib/aws-sdk-core/pageable_response.rb +82 -32
- data/lib/aws-sdk-core/pager.rb +5 -0
- data/lib/aws-sdk-core/param_converter.rb +2 -0
- data/lib/aws-sdk-core/param_validator.rb +54 -4
- data/lib/aws-sdk-core/plugins/api_key.rb +5 -1
- data/lib/aws-sdk-core/plugins/apig_authorizer_token.rb +2 -0
- data/lib/aws-sdk-core/plugins/apig_credentials_configuration.rb +2 -0
- data/lib/aws-sdk-core/plugins/apig_user_agent.rb +2 -0
- data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +340 -0
- data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +2 -0
- data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +2 -0
- data/lib/aws-sdk-core/plugins/credentials_configuration.rb +26 -7
- data/lib/aws-sdk-core/plugins/defaults_mode.rb +40 -0
- data/lib/aws-sdk-core/plugins/endpoint_discovery.rb +2 -0
- data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +8 -6
- data/lib/aws-sdk-core/plugins/event_stream_configuration.rb +2 -0
- data/lib/aws-sdk-core/plugins/global_configuration.rb +2 -0
- data/lib/aws-sdk-core/plugins/helpful_socket_errors.rb +2 -0
- data/lib/aws-sdk-core/plugins/http_checksum.rb +10 -1
- data/lib/aws-sdk-core/plugins/idempotency_token.rb +2 -0
- data/lib/aws-sdk-core/plugins/invocation_id.rb +2 -0
- data/lib/aws-sdk-core/plugins/jsonvalue_converter.rb +2 -0
- data/lib/aws-sdk-core/plugins/logging.rb +2 -0
- data/lib/aws-sdk-core/plugins/param_converter.rb +2 -0
- data/lib/aws-sdk-core/plugins/param_validator.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/api_gateway.rb +19 -0
- data/lib/aws-sdk-core/plugins/protocols/ec2.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/query.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +18 -1
- data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +2 -0
- data/lib/aws-sdk-core/plugins/recursion_detection.rb +27 -0
- data/lib/aws-sdk-core/plugins/regional_endpoint.rb +50 -2
- data/lib/aws-sdk-core/plugins/response_paging.rb +3 -1
- data/lib/aws-sdk-core/plugins/retries/client_rate_limiter.rb +2 -0
- data/lib/aws-sdk-core/plugins/retries/clock_skew.rb +2 -0
- data/lib/aws-sdk-core/plugins/retries/error_inspector.rb +7 -3
- data/lib/aws-sdk-core/plugins/retries/retry_quota.rb +2 -0
- data/lib/aws-sdk-core/plugins/retry_errors.rb +15 -6
- data/lib/aws-sdk-core/plugins/signature_v2.rb +2 -0
- data/lib/aws-sdk-core/plugins/signature_v4.rb +17 -24
- data/lib/aws-sdk-core/plugins/stub_responses.rb +9 -1
- data/lib/aws-sdk-core/plugins/transfer_encoding.rb +2 -0
- data/lib/aws-sdk-core/plugins/user_agent.rb +2 -0
- data/lib/aws-sdk-core/process_credentials.rb +8 -6
- data/lib/aws-sdk-core/query/ec2_param_builder.rb +2 -0
- data/lib/aws-sdk-core/query/handler.rb +2 -0
- data/lib/aws-sdk-core/query/param.rb +2 -0
- data/lib/aws-sdk-core/query/param_builder.rb +2 -0
- data/lib/aws-sdk-core/query/param_list.rb +2 -0
- data/lib/aws-sdk-core/query.rb +2 -0
- data/lib/aws-sdk-core/refreshing_credentials.rb +42 -11
- data/lib/aws-sdk-core/resources/collection.rb +2 -0
- data/lib/aws-sdk-core/rest/handler.rb +2 -0
- data/lib/aws-sdk-core/rest/request/body.rb +21 -1
- data/lib/aws-sdk-core/rest/request/builder.rb +2 -0
- data/lib/aws-sdk-core/rest/request/endpoint.rb +2 -0
- data/lib/aws-sdk-core/rest/request/headers.rb +20 -6
- data/lib/aws-sdk-core/rest/request/querystring_builder.rb +2 -0
- data/lib/aws-sdk-core/rest/response/body.rb +2 -0
- data/lib/aws-sdk-core/rest/response/headers.rb +6 -3
- data/lib/aws-sdk-core/rest/response/parser.rb +2 -0
- data/lib/aws-sdk-core/rest/response/status_code.rb +2 -0
- data/lib/aws-sdk-core/rest.rb +2 -0
- data/lib/aws-sdk-core/shared_config.rb +62 -8
- data/lib/aws-sdk-core/shared_credentials.rb +9 -1
- data/lib/aws-sdk-core/sso_credentials.rb +137 -0
- data/lib/aws-sdk-core/structure.rb +13 -2
- data/lib/aws-sdk-core/stubbing/data_applicator.rb +2 -0
- data/lib/aws-sdk-core/stubbing/empty_stub.rb +2 -0
- data/lib/aws-sdk-core/stubbing/protocols/api_gateway.rb +2 -0
- data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +2 -0
- data/lib/aws-sdk-core/stubbing/protocols/json.rb +3 -1
- data/lib/aws-sdk-core/stubbing/protocols/query.rb +2 -0
- data/lib/aws-sdk-core/stubbing/protocols/rest.rb +3 -1
- data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +3 -1
- data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +2 -2
- data/lib/aws-sdk-core/stubbing/stub_data.rb +2 -0
- data/lib/aws-sdk-core/stubbing/xml_error.rb +2 -0
- data/lib/aws-sdk-core/type_builder.rb +2 -0
- data/lib/aws-sdk-core/util.rb +2 -0
- data/lib/aws-sdk-core/waiters/errors.rb +2 -0
- data/lib/aws-sdk-core/waiters/poller.rb +2 -0
- data/lib/aws-sdk-core/waiters/waiter.rb +2 -0
- data/lib/aws-sdk-core/waiters.rb +2 -0
- data/lib/aws-sdk-core/xml/builder.rb +4 -2
- data/lib/aws-sdk-core/xml/default_list.rb +2 -0
- data/lib/aws-sdk-core/xml/default_map.rb +2 -0
- data/lib/aws-sdk-core/xml/doc_builder.rb +8 -1
- data/lib/aws-sdk-core/xml/error_handler.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/engines/libxml.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/engines/nokogiri.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/engines/oga.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/engines/ox.rb +3 -1
- data/lib/aws-sdk-core/xml/parser/engines/rexml.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/frame.rb +25 -0
- data/lib/aws-sdk-core/xml/parser/parsing_error.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/stack.rb +2 -0
- data/lib/aws-sdk-core/xml/parser.rb +7 -0
- data/lib/aws-sdk-core/xml.rb +2 -0
- data/lib/aws-sdk-core.rb +15 -3
- data/lib/aws-sdk-sso/client.rb +570 -0
- data/lib/aws-sdk-sso/client_api.rb +190 -0
- data/lib/aws-sdk-sso/customizations.rb +1 -0
- data/lib/aws-sdk-sso/errors.rb +102 -0
- data/lib/aws-sdk-sso/resource.rb +26 -0
- data/lib/aws-sdk-sso/types.rb +352 -0
- data/lib/aws-sdk-sso.rb +55 -0
- data/lib/aws-sdk-sts/client.rb +538 -435
- data/lib/aws-sdk-sts/client_api.rb +9 -1
- data/lib/aws-sdk-sts/customizations.rb +2 -0
- data/lib/aws-sdk-sts/errors.rb +3 -1
- data/lib/aws-sdk-sts/plugins/sts_regional_endpoints.rb +7 -1
- data/lib/aws-sdk-sts/presigner.rb +9 -1
- data/lib/aws-sdk-sts/resource.rb +3 -1
- data/lib/aws-sdk-sts/types.rb +360 -191
- data/lib/aws-sdk-sts.rb +10 -3
- data/lib/seahorse/client/async_base.rb +2 -0
- data/lib/seahorse/client/async_response.rb +2 -0
- data/lib/seahorse/client/base.rb +3 -0
- data/lib/seahorse/client/block_io.rb +5 -2
- data/lib/seahorse/client/configuration.rb +6 -0
- data/lib/seahorse/client/events.rb +2 -0
- data/lib/seahorse/client/h2/connection.rb +17 -13
- data/lib/seahorse/client/h2/handler.rb +6 -5
- data/lib/seahorse/client/handler.rb +2 -0
- data/lib/seahorse/client/handler_builder.rb +2 -0
- data/lib/seahorse/client/handler_list.rb +2 -0
- data/lib/seahorse/client/handler_list_entry.rb +2 -0
- data/lib/seahorse/client/http/async_response.rb +2 -0
- data/lib/seahorse/client/http/headers.rb +2 -0
- data/lib/seahorse/client/http/request.rb +2 -0
- data/lib/seahorse/client/http/response.rb +3 -1
- data/lib/seahorse/client/logging/formatter.rb +2 -0
- data/lib/seahorse/client/logging/handler.rb +2 -0
- data/lib/seahorse/client/managed_file.rb +2 -0
- data/lib/seahorse/client/net_http/connection_pool.rb +12 -4
- data/lib/seahorse/client/net_http/handler.rb +19 -8
- data/lib/seahorse/client/net_http/patches.rb +15 -84
- data/lib/seahorse/client/networking_error.rb +2 -0
- data/lib/seahorse/client/plugin.rb +2 -0
- data/lib/seahorse/client/plugin_list.rb +2 -0
- data/lib/seahorse/client/plugins/content_length.rb +13 -5
- data/lib/seahorse/client/plugins/endpoint.rb +2 -0
- data/lib/seahorse/client/plugins/h2.rb +6 -1
- data/lib/seahorse/client/plugins/logging.rb +2 -0
- data/lib/seahorse/client/plugins/net_http.rb +39 -3
- data/lib/seahorse/client/plugins/operation_methods.rb +2 -0
- data/lib/seahorse/client/plugins/raise_response_errors.rb +2 -0
- data/lib/seahorse/client/plugins/request_callback.rb +110 -0
- data/lib/seahorse/client/plugins/response_target.rb +8 -8
- data/lib/seahorse/client/request.rb +2 -0
- data/lib/seahorse/client/request_context.rb +2 -0
- data/lib/seahorse/client/response.rb +2 -0
- data/lib/seahorse/model/api.rb +2 -0
- data/lib/seahorse/model/authorizer.rb +2 -0
- data/lib/seahorse/model/operation.rb +5 -0
- data/lib/seahorse/model/shapes.rb +27 -0
- data/lib/seahorse/util.rb +8 -1
- data/lib/seahorse/version.rb +2 -0
- data/lib/seahorse.rb +3 -0
- metadata +26 -9
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
module Json
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
module JSONEngine
|
|
6
|
+
class << self
|
|
7
|
+
def load(json)
|
|
8
|
+
JSON.parse(json)
|
|
9
|
+
rescue JSON::ParserError => e
|
|
10
|
+
raise ParseError.new(e)
|
|
11
|
+
end
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
def dump(value)
|
|
14
|
+
JSON.dump(value)
|
|
15
|
+
end
|
|
11
16
|
end
|
|
12
|
-
|
|
13
17
|
end
|
|
14
18
|
end
|
|
15
19
|
end
|
|
@@ -1,15 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
module Json
|
|
3
|
-
|
|
5
|
+
module OjEngine
|
|
6
|
+
# @api private
|
|
7
|
+
LOAD_OPTIONS = { mode: :compat, symbol_keys: false, empty_string: false }.freeze
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
# @api private
|
|
10
|
+
DUMP_OPTIONS = { mode: :compat }.freeze
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
def load(json)
|
|
14
|
+
Oj.load(json, LOAD_OPTIONS)
|
|
15
|
+
rescue *PARSE_ERRORS => e
|
|
16
|
+
raise ParseError.new(e)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def dump(value)
|
|
20
|
+
Oj.dump(value, DUMP_OPTIONS)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
# Oj before 1.4.0 does not define Oj::ParseError and instead raises
|
|
26
|
+
# SyntaxError on failure
|
|
27
|
+
def detect_oj_parse_errors
|
|
28
|
+
require 'oj'
|
|
8
29
|
|
|
9
|
-
|
|
10
|
-
|
|
30
|
+
if Oj.const_defined?(:ParseError)
|
|
31
|
+
[Oj::ParseError, EncodingError, JSON::ParserError]
|
|
32
|
+
else
|
|
33
|
+
[SyntaxError]
|
|
34
|
+
end
|
|
35
|
+
rescue LoadError
|
|
36
|
+
nil
|
|
37
|
+
end
|
|
11
38
|
end
|
|
12
39
|
|
|
40
|
+
# @api private
|
|
41
|
+
PARSE_ERRORS = detect_oj_parse_errors
|
|
13
42
|
end
|
|
14
43
|
end
|
|
15
44
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'base64'
|
|
2
4
|
require 'time'
|
|
3
5
|
|
|
@@ -26,8 +28,16 @@ module Aws
|
|
|
26
28
|
member_name, member_ref = shape.member_by_location_name(key)
|
|
27
29
|
if member_ref
|
|
28
30
|
target[member_name] = parse_ref(member_ref, value)
|
|
31
|
+
elsif shape.union
|
|
32
|
+
target[:unknown] = { 'name' => key, 'value' => value }
|
|
29
33
|
end
|
|
30
34
|
end
|
|
35
|
+
if shape.union
|
|
36
|
+
# convert to subclass
|
|
37
|
+
member_subclass = shape.member_subclass(target.member).new
|
|
38
|
+
member_subclass[target.member] = target.value
|
|
39
|
+
target = member_subclass
|
|
40
|
+
end
|
|
31
41
|
target
|
|
32
42
|
end
|
|
33
43
|
|
data/lib/aws-sdk-core/json.rb
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'json'
|
|
2
4
|
require_relative 'json/builder'
|
|
3
5
|
require_relative 'json/error_handler'
|
|
4
6
|
require_relative 'json/handler'
|
|
5
7
|
require_relative 'json/parser'
|
|
8
|
+
require_relative 'json/json_engine'
|
|
9
|
+
require_relative 'json/oj_engine'
|
|
6
10
|
|
|
7
11
|
module Aws
|
|
8
12
|
# @api private
|
|
@@ -18,9 +22,7 @@ module Aws
|
|
|
18
22
|
|
|
19
23
|
class << self
|
|
20
24
|
def load(json)
|
|
21
|
-
ENGINE.load(json
|
|
22
|
-
rescue *ENGINE_ERRORS => e
|
|
23
|
-
raise ParseError, e
|
|
25
|
+
ENGINE.load(json)
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
def load_file(path)
|
|
@@ -28,38 +30,20 @@ module Aws
|
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
def dump(value)
|
|
31
|
-
ENGINE.dump(value
|
|
33
|
+
ENGINE.dump(value)
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
private
|
|
35
37
|
|
|
36
|
-
def
|
|
38
|
+
def select_engine
|
|
37
39
|
require 'oj'
|
|
38
|
-
|
|
39
|
-
Oj,
|
|
40
|
-
[{ mode: :compat, symbol_keys: false }],
|
|
41
|
-
[{ mode: :compat }],
|
|
42
|
-
oj_parse_error
|
|
43
|
-
]
|
|
40
|
+
OjEngine
|
|
44
41
|
rescue LoadError
|
|
45
|
-
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def json_engine
|
|
49
|
-
[JSON, [], [], [JSON::ParserError]]
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def oj_parse_error
|
|
53
|
-
if Oj.const_defined?('ParseError')
|
|
54
|
-
[Oj::ParseError, EncodingError, JSON::ParserError]
|
|
55
|
-
else
|
|
56
|
-
[SyntaxError]
|
|
57
|
-
end
|
|
42
|
+
JSONEngine
|
|
58
43
|
end
|
|
59
44
|
end
|
|
60
45
|
|
|
61
46
|
# @api private
|
|
62
|
-
ENGINE
|
|
63
|
-
oj_engine || json_engine
|
|
47
|
+
ENGINE = select_engine
|
|
64
48
|
end
|
|
65
49
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'pathname'
|
|
2
4
|
|
|
3
5
|
module Aws
|
|
@@ -83,6 +85,9 @@ module Aws
|
|
|
83
85
|
# The default list of filtered parameters is documented on the
|
|
84
86
|
# {ParamFilter} class.
|
|
85
87
|
#
|
|
88
|
+
# @option options [Boolean] :filter_sensitive_params (true) Set to false
|
|
89
|
+
# to disable the sensitive parameter filtering when logging
|
|
90
|
+
# `:request_params`.
|
|
86
91
|
def initialize(pattern, options = {})
|
|
87
92
|
@pattern = pattern
|
|
88
93
|
@param_formatter = ParamFormatter.new(options)
|
|
@@ -92,12 +97,12 @@ module Aws
|
|
|
92
97
|
# @return [String]
|
|
93
98
|
attr_reader :pattern
|
|
94
99
|
|
|
95
|
-
# Given a
|
|
100
|
+
# Given a response, this will format a log message and return it as a
|
|
96
101
|
# string according to {#pattern}.
|
|
97
102
|
# @param [Seahorse::Client::Response] response
|
|
98
103
|
# @return [String]
|
|
99
104
|
def format(response)
|
|
100
|
-
pattern.gsub(/:(\w+)/) {|sym| send("_#{sym[1..-1]}", response) }
|
|
105
|
+
pattern.gsub(/:(\w+)/) { |sym| send("_#{sym[1..-1]}", response) }
|
|
101
106
|
end
|
|
102
107
|
|
|
103
108
|
# @api private
|
|
@@ -121,7 +126,8 @@ module Aws
|
|
|
121
126
|
|
|
122
127
|
def _request_params(response)
|
|
123
128
|
params = response.context.params
|
|
124
|
-
|
|
129
|
+
type = response.context.operation.input.shape.struct_class
|
|
130
|
+
@param_formatter.summarize(@param_filter.filter(params, type))
|
|
125
131
|
end
|
|
126
132
|
|
|
127
133
|
def _time(response)
|
|
@@ -1,43 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'pathname'
|
|
2
4
|
require 'set'
|
|
3
5
|
|
|
4
6
|
module Aws
|
|
5
7
|
module Log
|
|
6
8
|
class ParamFilter
|
|
7
|
-
|
|
9
|
+
# DEPRECATED - This must exist for backwards compatibility. Sensitive
|
|
10
|
+
# members are now computed for each request/response type. This can be
|
|
11
|
+
# removed in a new major version. This list is no longer updated.
|
|
12
|
+
#
|
|
8
13
|
# A managed list of sensitive parameters that should be filtered from
|
|
9
14
|
# logs. This is updated automatically as part of each release. See the
|
|
10
15
|
# `tasks/update-sensitive-params.rake` for more information.
|
|
11
16
|
#
|
|
12
17
|
# @api private
|
|
13
18
|
# begin
|
|
14
|
-
SENSITIVE = [:access_token, :account_name, :account_password, :address, :admin_contact, :admin_password, :alexa_for_business_room_arn, :artifact_credentials, :auth_code, :auth_parameters, :authentication_token, :authorization_result, :backup_plan_tags, :backup_vault_tags, :base_32_string_seed, :block, :block_address, :block_data, :blocks, :body, :bot_configuration, :bot_email, :calling_name, :cause, :client_id, :client_request_token, :client_secret, :comment, :configuration, :content, :copy_source_sse_customer_key, :credentials, :current_password, :custom_attributes, :custom_private_key, :db_password, :default_phone_number, :definition, :description, :destination_access_token, :digest_tip_address, :display_name, :domain_signing_private_key, :e164_phone_number, :email, :email_address, :email_message, :embed_url, :error, :external_meeting_id, :external_model_endpoint_data_blobs, :external_user_id, :fall_back_phone_number, :feedback_token, :file, :filter_expression, :first_name, :full_name, :host_key, :id, :id_token, :input, :input_text, :ion_text, :join_token, :key, :key_id, :key_material, :key_store_password, :kms_key_id, :kms_master_key_id, :lambda_function_arn, :last_name, :local_console_password, :master_account_email, :master_user_name, :master_user_password, :meeting_host_id, :message, :metadata, :name, :new_password, :next_password, :notes, :number, :old_password, :outbound_events_https_endpoint, :output, :owner_information, :parameters, :passphrase, :password, :payload, :phone_number, :plaintext, :previous_password, :primary_email, :primary_provisioned_number, :private_key, :private_key_plaintext, :proof, :proposed_password, :proxy_phone_number, :public_key, :qr_code_png, :query, :random_password, :recovery_point_tags, :refresh_token, :registrant_contact, :request_attributes, :resource_arn, :restore_metadata, :revision, :saml_assertion, :search_query, :secret_access_key, :secret_binary, :secret_code, :secret_hash, :secret_string, :secret_to_authenticate_initiator, :secret_to_authenticate_target, :security_token, :service_password, :session_attributes, :session_token, :share_notes, :shared_secret, :slots, :sns_topic_arn, :source_access_token, :sqs_queue_arn, :sse_customer_key, :ssekms_encryption_context, :ssekms_key_id, :status_message, :tag_key_list, :tags, :target_address, :task_parameters, :tech_contact, :temporary_password, :text, :token, :trust_password, :type, :upload_credentials, :upload_url, :uri, :user_data, :user_email, :user_name, :user_password, :username, :value, :values, :variables, :vpn_psk, :web_identity_token, :zip_file]
|
|
19
|
+
SENSITIVE = [:access_token, :account_name, :account_password, :address, :admin_contact, :admin_password, :alexa_for_business_room_arn, :artifact_credentials, :auth_code, :auth_parameters, :authentication_token, :authorization_result, :backup_plan_tags, :backup_vault_tags, :base_32_string_seed, :basic_auth_credentials, :block, :block_address, :block_data, :blocks, :body, :bot_configuration, :bot_email, :calling_name, :cause, :client_id, :client_request_token, :client_secret, :comment, :configuration, :content, :copy_source_sse_customer_key, :credentials, :current_password, :custom_attributes, :custom_private_key, :db_password, :default_phone_number, :definition, :description, :destination_access_token, :digest_tip_address, :display_name, :domain_signing_private_key, :e164_phone_number, :email, :email_address, :email_message, :embed_url, :emergency_phone_number, :error, :external_meeting_id, :external_model_endpoint_data_blobs, :external_user_id, :fall_back_phone_number, :feedback_token, :file, :filter_expression, :first_name, :full_name, :host_key, :id, :id_token, :input, :input_text, :ion_text, :join_token, :key, :key_id, :key_material, :key_store_password, :kms_key_id, :kms_master_key_id, :lambda_function_arn, :last_name, :local_console_password, :master_account_email, :master_user_name, :master_user_password, :meeting_host_id, :message, :metadata, :name, :new_password, :next_password, :notes, :number, :oauth_token, :old_password, :outbound_events_https_endpoint, :output, :owner_information, :parameters, :passphrase, :password, :payload, :phone_number, :plaintext, :previous_password, :primary_email, :primary_provisioned_number, :private_key, :private_key_plaintext, :proof, :proposed_password, :proxy_phone_number, :public_key, :qr_code_png, :query, :random_password, :recovery_point_tags, :refresh_token, :registrant_contact, :request_attributes, :resource_arn, :restore_metadata, :revision, :saml_assertion, :search_query, :secret_access_key, :secret_binary, :secret_code, :secret_hash, :secret_string, :secret_to_authenticate_initiator, :secret_to_authenticate_target, :security_token, :service_password, :session_attributes, :session_token, :share_notes, :shared_secret, :slots, :sns_topic_arn, :source_access_token, :sqs_queue_arn, :sse_customer_key, :ssekms_encryption_context, :ssekms_key_id, :status_message, :tag_key_list, :tags, :target_address, :task_parameters, :tech_contact, :temporary_password, :test_phone_number, :text, :token, :trust_password, :type, :upload_credentials, :upload_url, :uri, :user_data, :user_email, :user_name, :user_password, :username, :value, :values, :variables, :vpn_psk, :web_identity_token, :zip_file]
|
|
15
20
|
# end
|
|
16
21
|
|
|
17
22
|
def initialize(options = {})
|
|
18
|
-
@
|
|
23
|
+
@enabled = options[:filter_sensitive_params] != false
|
|
24
|
+
@additional_filters = options[:filter] || []
|
|
19
25
|
end
|
|
20
26
|
|
|
21
|
-
def filter(
|
|
22
|
-
case
|
|
23
|
-
when Struct
|
|
24
|
-
when
|
|
25
|
-
|
|
27
|
+
def filter(values, type)
|
|
28
|
+
case values
|
|
29
|
+
when Struct then filter_struct(values, type)
|
|
30
|
+
when Hash then filter_hash(values, type)
|
|
31
|
+
when Array then filter_array(values, type)
|
|
32
|
+
else values
|
|
26
33
|
end
|
|
27
34
|
end
|
|
28
35
|
|
|
29
36
|
private
|
|
30
37
|
|
|
31
|
-
def
|
|
38
|
+
def filter_struct(values, type)
|
|
39
|
+
if values.class.include? Aws::Structure::Union
|
|
40
|
+
values = { values.member => values.value }
|
|
41
|
+
end
|
|
42
|
+
filter_hash(values, type)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def filter_hash(values, type)
|
|
46
|
+
if type.const_defined?('SENSITIVE')
|
|
47
|
+
filters = type::SENSITIVE + @additional_filters
|
|
48
|
+
else
|
|
49
|
+
# Support backwards compatibility (new core + old service)
|
|
50
|
+
filters = SENSITIVE + @additional_filters
|
|
51
|
+
end
|
|
52
|
+
|
|
32
53
|
filtered = {}
|
|
33
54
|
values.each_pair do |key, value|
|
|
34
|
-
filtered[key] = @filters.
|
|
55
|
+
filtered[key] = if @enabled && filters.include?(key)
|
|
56
|
+
'[FILTERED]'
|
|
57
|
+
else
|
|
58
|
+
filter(value, type)
|
|
59
|
+
end
|
|
35
60
|
end
|
|
36
61
|
filtered
|
|
37
62
|
end
|
|
38
63
|
|
|
39
|
-
def filter_array(values)
|
|
40
|
-
values.map { |value| filter(value) }
|
|
64
|
+
def filter_array(values, type)
|
|
65
|
+
values.map { |value| filter(value, type) }
|
|
41
66
|
end
|
|
42
67
|
|
|
43
68
|
end
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
module Aws
|
|
3
4
|
# Decorates a {Seahorse::Client::Response} with paging convenience methods.
|
|
4
5
|
# Some AWS calls provide paged responses to limit the amount of data returned
|
|
5
|
-
# with each response.
|
|
6
|
-
# inconsistent number of responses per page.
|
|
7
|
-
# the `next_page?` method or using enumerable methods such as `each`
|
|
8
|
-
#
|
|
9
|
-
#
|
|
6
|
+
# with each response. To optimize for latency, some APIs may return an
|
|
7
|
+
# inconsistent number of responses per page. You should rely on the values of
|
|
8
|
+
# the `next_page?` method or using enumerable methods such as `each` rather
|
|
9
|
+
# than the number of items returned to iterate through results. See below for
|
|
10
|
+
# examples.
|
|
11
|
+
#
|
|
12
|
+
# @note Methods such as `to_json` will enumerate all of the responses before
|
|
13
|
+
# returning the full response as JSON.
|
|
10
14
|
#
|
|
11
15
|
# # Paged Responses Are Enumerable
|
|
12
16
|
# The simplest way to handle paged response data is to use the built-in
|
|
@@ -44,11 +48,11 @@ module Aws
|
|
|
44
48
|
#
|
|
45
49
|
module PageableResponse
|
|
46
50
|
|
|
47
|
-
def self.
|
|
48
|
-
base.
|
|
49
|
-
base.
|
|
50
|
-
base.instance_variable_set(
|
|
51
|
-
base
|
|
51
|
+
def self.apply(base)
|
|
52
|
+
base.extend Extension
|
|
53
|
+
base.instance_variable_set(:@last_page, nil)
|
|
54
|
+
base.instance_variable_set(:@more_results, nil)
|
|
55
|
+
base
|
|
52
56
|
end
|
|
53
57
|
|
|
54
58
|
# @return [Paging::Pager]
|
|
@@ -58,39 +62,26 @@ module Aws
|
|
|
58
62
|
# when this method returns `false` will raise an error.
|
|
59
63
|
# @return [Boolean]
|
|
60
64
|
def last_page?
|
|
61
|
-
|
|
62
|
-
@last_page = !@pager.truncated?(self)
|
|
63
|
-
end
|
|
64
|
-
@last_page
|
|
65
|
+
# Actual implementation is in PageableResponse::Extension
|
|
65
66
|
end
|
|
66
67
|
|
|
67
68
|
# Returns `true` if there are more results. Calling {#next_page} will
|
|
68
69
|
# return the next response.
|
|
69
70
|
# @return [Boolean]
|
|
70
71
|
def next_page?
|
|
71
|
-
|
|
72
|
+
# Actual implementation is in PageableResponse::Extension
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
# @return [Seahorse::Client::Response]
|
|
75
76
|
def next_page(params = {})
|
|
76
|
-
|
|
77
|
-
raise LastPageError.new(self)
|
|
78
|
-
else
|
|
79
|
-
next_response(params)
|
|
80
|
-
end
|
|
77
|
+
# Actual implementation is in PageableResponse::Extension
|
|
81
78
|
end
|
|
82
79
|
|
|
83
80
|
# Yields the current and each following response to the given block.
|
|
84
81
|
# @yieldparam [Response] response
|
|
85
82
|
# @return [Enumerable,nil] Returns a new Enumerable if no block is given.
|
|
86
83
|
def each(&block)
|
|
87
|
-
|
|
88
|
-
response = self
|
|
89
|
-
yield(response)
|
|
90
|
-
until response.last_page?
|
|
91
|
-
response = response.next_page
|
|
92
|
-
yield(response)
|
|
93
|
-
end
|
|
84
|
+
# Actual implementation is in PageableResponse::Extension
|
|
94
85
|
end
|
|
95
86
|
alias each_page each
|
|
96
87
|
|
|
@@ -101,9 +92,7 @@ module Aws
|
|
|
101
92
|
# @return [Seahorse::Client::Response] Returns the next page of
|
|
102
93
|
# results.
|
|
103
94
|
def next_response(params)
|
|
104
|
-
|
|
105
|
-
request = context.client.build_request(context.operation_name, params)
|
|
106
|
-
request.send_request
|
|
95
|
+
# Actual implementation is in PageableResponse::Extension
|
|
107
96
|
end
|
|
108
97
|
|
|
109
98
|
# @param [Hash] params A hash of additional request params to
|
|
@@ -111,7 +100,7 @@ module Aws
|
|
|
111
100
|
# @return [Hash] Returns the hash of request parameters for the
|
|
112
101
|
# next page, merging any given params.
|
|
113
102
|
def next_page_params(params)
|
|
114
|
-
|
|
103
|
+
# Actual implementation is in PageableResponse::Extension
|
|
115
104
|
end
|
|
116
105
|
|
|
117
106
|
# Raised when calling {PageableResponse#next_page} on a pager that
|
|
@@ -158,5 +147,66 @@ module Aws
|
|
|
158
147
|
end
|
|
159
148
|
|
|
160
149
|
end
|
|
150
|
+
|
|
151
|
+
# The actual decorator module implementation. It is in a distinct module
|
|
152
|
+
# so that it can be used to extend objects without busting Ruby's constant cache.
|
|
153
|
+
# object.extend(mod) bust the constant cache only if `mod` contains constants of its own.
|
|
154
|
+
# @api private
|
|
155
|
+
module Extension
|
|
156
|
+
|
|
157
|
+
include Enumerable
|
|
158
|
+
include UnsafeEnumerableMethods
|
|
159
|
+
|
|
160
|
+
attr_accessor :pager
|
|
161
|
+
|
|
162
|
+
def last_page?
|
|
163
|
+
if @last_page.nil?
|
|
164
|
+
@last_page = !@pager.truncated?(self)
|
|
165
|
+
end
|
|
166
|
+
@last_page
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def next_page?
|
|
170
|
+
!last_page?
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def next_page(params = {})
|
|
174
|
+
if last_page?
|
|
175
|
+
raise LastPageError.new(self)
|
|
176
|
+
else
|
|
177
|
+
next_response(params)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def each(&block)
|
|
182
|
+
return enum_for(:each_page) unless block_given?
|
|
183
|
+
response = self
|
|
184
|
+
yield(response)
|
|
185
|
+
until response.last_page?
|
|
186
|
+
response = response.next_page
|
|
187
|
+
yield(response)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
alias each_page each
|
|
191
|
+
|
|
192
|
+
private
|
|
193
|
+
|
|
194
|
+
def next_response(params)
|
|
195
|
+
params = next_page_params(params)
|
|
196
|
+
request = context.client.build_request(context.operation_name, params)
|
|
197
|
+
request.send_request
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def next_page_params(params)
|
|
201
|
+
# Remove all previous tokens from original params
|
|
202
|
+
# Sometimes a token can be nil and merge would not include it.
|
|
203
|
+
tokens = @pager.tokens.values.map(&:to_sym)
|
|
204
|
+
|
|
205
|
+
params_without_tokens = context[:original_params].reject { |k, _v| tokens.include?(k) }
|
|
206
|
+
params_without_tokens.merge!(@pager.next_tokens(self).merge(params))
|
|
207
|
+
params_without_tokens
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
end
|
|
161
211
|
end
|
|
162
212
|
end
|
data/lib/aws-sdk-core/pager.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'jmespath'
|
|
2
4
|
|
|
3
5
|
module Aws
|
|
@@ -16,6 +18,9 @@ module Aws
|
|
|
16
18
|
# @return [Symbol, nil]
|
|
17
19
|
attr_reader :limit_key
|
|
18
20
|
|
|
21
|
+
# @return [Hash, nil]
|
|
22
|
+
attr_reader :tokens
|
|
23
|
+
|
|
19
24
|
# @param [Seahorse::Client::Response] response
|
|
20
25
|
# @return [Hash]
|
|
21
26
|
def next_tokens(response)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
# @api private
|
|
3
5
|
class ParamValidator
|
|
@@ -68,6 +70,14 @@ module Aws
|
|
|
68
70
|
end
|
|
69
71
|
end
|
|
70
72
|
|
|
73
|
+
if @validate_required && shape.union
|
|
74
|
+
if values.length > 1
|
|
75
|
+
errors << "multiple values provided to union at #{context} - must contain exactly one of the supported types: #{shape.member_names.join(', ')}"
|
|
76
|
+
elsif values.length == 0
|
|
77
|
+
errors << "No values provided to union at #{context} - must contain exactly one of the supported types: #{shape.member_names.join(', ')}"
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
71
81
|
# validate non-nil members
|
|
72
82
|
values.each_pair do |name, value|
|
|
73
83
|
unless value.nil?
|
|
@@ -115,11 +125,32 @@ module Aws
|
|
|
115
125
|
end
|
|
116
126
|
end
|
|
117
127
|
|
|
128
|
+
def document(ref, value, errors, context)
|
|
129
|
+
document_types = [Hash, Array, Numeric, String, TrueClass, FalseClass, NilClass]
|
|
130
|
+
unless document_types.any? { |t| value.is_a?(t) }
|
|
131
|
+
errors << expected_got(context, "one of #{document_types.join(', ')}", value)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# recursively validate types for aggregated types
|
|
135
|
+
case value
|
|
136
|
+
when Hash
|
|
137
|
+
value.each do |k, v|
|
|
138
|
+
document(ref, v, errors, context + "[#{k}]")
|
|
139
|
+
end
|
|
140
|
+
when Array
|
|
141
|
+
value.each do |v|
|
|
142
|
+
document(ref, v, errors, context)
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
end
|
|
147
|
+
|
|
118
148
|
def shape(ref, value, errors, context)
|
|
119
149
|
case ref.shape
|
|
120
150
|
when StructureShape then structure(ref, value, errors, context)
|
|
121
151
|
when ListShape then list(ref, value, errors, context)
|
|
122
152
|
when MapShape then map(ref, value, errors, context)
|
|
153
|
+
when DocumentShape then document(ref, value, errors, context)
|
|
123
154
|
when StringShape
|
|
124
155
|
unless value.is_a?(String)
|
|
125
156
|
errors << expected_got(context, "a String", value)
|
|
@@ -141,8 +172,22 @@ module Aws
|
|
|
141
172
|
errors << expected_got(context, "true or false", value)
|
|
142
173
|
end
|
|
143
174
|
when BlobShape
|
|
144
|
-
unless value.is_a?(String)
|
|
145
|
-
|
|
175
|
+
unless value.is_a?(String)
|
|
176
|
+
if streaming_input?(ref)
|
|
177
|
+
unless io_like?(value, _require_size = false)
|
|
178
|
+
errors << expected_got(
|
|
179
|
+
context,
|
|
180
|
+
"a String or IO like object that supports read and rewind",
|
|
181
|
+
value
|
|
182
|
+
)
|
|
183
|
+
end
|
|
184
|
+
elsif !io_like?(value, _require_size = true)
|
|
185
|
+
errors << expected_got(
|
|
186
|
+
context,
|
|
187
|
+
"a String or IO like object that supports read, rewind, and size",
|
|
188
|
+
value
|
|
189
|
+
)
|
|
190
|
+
end
|
|
146
191
|
end
|
|
147
192
|
else
|
|
148
193
|
raise "unhandled shape type: #{ref.shape.class.name}"
|
|
@@ -165,8 +210,13 @@ module Aws
|
|
|
165
210
|
end
|
|
166
211
|
end
|
|
167
212
|
|
|
168
|
-
def io_like?(value)
|
|
169
|
-
value.respond_to?(:read) && value.respond_to?(:rewind)
|
|
213
|
+
def io_like?(value, require_size = true)
|
|
214
|
+
value.respond_to?(:read) && value.respond_to?(:rewind) &&
|
|
215
|
+
(!require_size || value.respond_to?(:size))
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def streaming_input?(ref)
|
|
219
|
+
(ref["streaming"] || ref.shape["streaming"])
|
|
170
220
|
end
|
|
171
221
|
|
|
172
222
|
def error_messages(errors)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
module Plugins
|
|
3
5
|
|
|
@@ -21,7 +23,9 @@ When provided, `x-api-key` header will be injected with the value provided.
|
|
|
21
23
|
class OptionHandler < Seahorse::Client::Handler
|
|
22
24
|
def call(context)
|
|
23
25
|
if context.operation.require_apikey
|
|
24
|
-
|
|
26
|
+
if context.params.is_a?(Hash) && context.params[:api_key]
|
|
27
|
+
api_key = context.params.delete(:api_key)
|
|
28
|
+
end
|
|
25
29
|
api_key = context.config.api_key if api_key.nil?
|
|
26
30
|
context[:api_key] = api_key
|
|
27
31
|
end
|