aws-sdk-core 2.1.15 → 2.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apis/codepipeline/2015-07-09/api-2.json +30 -4
- data/apis/opsworks/2013-02-18/waiters-2.json +20 -0
- data/bin/aws.rb +1 -1
- data/lib/aws-sdk-core.rb +7 -0
- data/lib/aws-sdk-core/client.rb +1 -1
- data/lib/aws-sdk-core/log/formatter.rb +249 -0
- data/lib/aws-sdk-core/log/handler.rb +35 -0
- data/lib/aws-sdk-core/log/param_filter.rb +43 -0
- data/lib/aws-sdk-core/log/param_formatter.rb +68 -0
- data/lib/aws-sdk-core/pageable_response.rb +1 -1
- data/lib/aws-sdk-core/plugins/logging.rb +64 -0
- data/lib/aws-sdk-core/version.rb +1 -1
- data/lib/seahorse.rb +2 -0
- data/lib/seahorse/client/configuration.rb +1 -1
- data/lib/seahorse/client/response.rb +6 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc2f401308dd78a076bbe8c47554c31dc6781399
|
4
|
+
data.tar.gz: 5d6e0d172a31dd25f69f4df5aa8f62fbd8fcfcb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81f4a66d57dcf5f94f0132f3dbdbff7f1f0022632f7d6e6a422e20242ddba740141e404d3bb102e2cbf40abca48a6cae2e9a30c80ee67c3c934c53648e992903
|
7
|
+
data.tar.gz: ce220fa2d46bcb6554f8bca278976f4e4f89b26cb2edce85d7a3bc2dd5d366aef0a3dbc97661a7618f24747fd62fea2ce0b220004f7e857b8d17aad73aef1512
|
@@ -845,7 +845,8 @@
|
|
845
845
|
],
|
846
846
|
"members":{
|
847
847
|
"type":{"shape":"ArtifactStoreType"},
|
848
|
-
"location":{"shape":"ArtifactStoreLocation"}
|
848
|
+
"location":{"shape":"ArtifactStoreLocation"},
|
849
|
+
"encryptionKey":{"shape":"EncryptionKey"}
|
849
850
|
}
|
850
851
|
},
|
851
852
|
"ArtifactStoreLocation":{
|
@@ -996,6 +997,26 @@
|
|
996
997
|
}
|
997
998
|
},
|
998
999
|
"Enabled":{"type":"boolean"},
|
1000
|
+
"EncryptionKey":{
|
1001
|
+
"type":"structure",
|
1002
|
+
"required":[
|
1003
|
+
"id",
|
1004
|
+
"type"
|
1005
|
+
],
|
1006
|
+
"members":{
|
1007
|
+
"id":{"shape":"EncryptionKeyId"},
|
1008
|
+
"type":{"shape":"EncryptionKeyType"}
|
1009
|
+
}
|
1010
|
+
},
|
1011
|
+
"EncryptionKeyId":{
|
1012
|
+
"type":"string",
|
1013
|
+
"min":1,
|
1014
|
+
"max":100
|
1015
|
+
},
|
1016
|
+
"EncryptionKeyType":{
|
1017
|
+
"type":"string",
|
1018
|
+
"enum":["KMS"]
|
1019
|
+
},
|
999
1020
|
"ErrorDetails":{
|
1000
1021
|
"type":"structure",
|
1001
1022
|
"members":{
|
@@ -1015,7 +1036,10 @@
|
|
1015
1036
|
"ExecutionSummary":{"type":"string"},
|
1016
1037
|
"FailureDetails":{
|
1017
1038
|
"type":"structure",
|
1018
|
-
"required":[
|
1039
|
+
"required":[
|
1040
|
+
"type",
|
1041
|
+
"message"
|
1042
|
+
],
|
1019
1043
|
"members":{
|
1020
1044
|
"type":{"shape":"FailureType"},
|
1021
1045
|
"message":{"shape":"Message"},
|
@@ -1177,7 +1201,8 @@
|
|
1177
1201
|
"inputArtifacts":{"shape":"ArtifactList"},
|
1178
1202
|
"outputArtifacts":{"shape":"ArtifactList"},
|
1179
1203
|
"artifactCredentials":{"shape":"AWSSessionCredentials"},
|
1180
|
-
"continuationToken":{"shape":"ContinuationToken"}
|
1204
|
+
"continuationToken":{"shape":"ContinuationToken"},
|
1205
|
+
"encryptionKey":{"shape":"EncryptionKey"}
|
1181
1206
|
}
|
1182
1207
|
},
|
1183
1208
|
"JobDetails":{
|
@@ -1571,7 +1596,8 @@
|
|
1571
1596
|
"inputArtifacts":{"shape":"ArtifactList"},
|
1572
1597
|
"outputArtifacts":{"shape":"ArtifactList"},
|
1573
1598
|
"artifactCredentials":{"shape":"AWSSessionCredentials"},
|
1574
|
-
"continuationToken":{"shape":"ContinuationToken"}
|
1599
|
+
"continuationToken":{"shape":"ContinuationToken"},
|
1600
|
+
"encryptionKey":{"shape":"EncryptionKey"}
|
1575
1601
|
}
|
1576
1602
|
},
|
1577
1603
|
"ThirdPartyJobDetails":{
|
@@ -18,6 +18,26 @@
|
|
18
18
|
}
|
19
19
|
]
|
20
20
|
},
|
21
|
+
"DeploymentSuccessful": {
|
22
|
+
"delay": 15,
|
23
|
+
"operation": "DescribeDeployments",
|
24
|
+
"maxAttempts": 40,
|
25
|
+
"description": "Wait until a deployment has completed successfully",
|
26
|
+
"acceptors": [
|
27
|
+
{
|
28
|
+
"expected": "successful",
|
29
|
+
"matcher": "pathAll",
|
30
|
+
"state": "success",
|
31
|
+
"argument": "Deployments[].Status"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"expected": "failed",
|
35
|
+
"matcher": "pathAny",
|
36
|
+
"state": "failure",
|
37
|
+
"argument": "Deployments[].Status"
|
38
|
+
}
|
39
|
+
]
|
40
|
+
},
|
21
41
|
"InstanceOnline": {
|
22
42
|
"delay": 15,
|
23
43
|
"operation": "DescribeInstances",
|
data/bin/aws.rb
CHANGED
data/lib/aws-sdk-core.rb
CHANGED
@@ -126,6 +126,12 @@ module Aws
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
+
module Log
|
130
|
+
autoload :Formatter, 'aws-sdk-core/log/formatter'
|
131
|
+
autoload :ParamFilter, 'aws-sdk-core/log/param_filter'
|
132
|
+
autoload :ParamFormatter, 'aws-sdk-core/log/param_formatter'
|
133
|
+
end
|
134
|
+
|
129
135
|
module Plugins
|
130
136
|
autoload :CSDConditionalSigning, 'aws-sdk-core/plugins/csd_conditional_signing'
|
131
137
|
autoload :DynamoDBExtendedRetries, 'aws-sdk-core/plugins/dynamodb_extended_retries'
|
@@ -136,6 +142,7 @@ module Aws
|
|
136
142
|
autoload :GlacierApiVersion, 'aws-sdk-core/plugins/glacier_api_version'
|
137
143
|
autoload :GlacierChecksums, 'aws-sdk-core/plugins/glacier_checksums'
|
138
144
|
autoload :GlobalConfiguration, 'aws-sdk-core/plugins/global_configuration'
|
145
|
+
autoload :Logging, 'aws-sdk-core/plugins/logging'
|
139
146
|
autoload :MachineLearningPredictEndpoint, 'aws-sdk-core/plugins/machine_learning_predict_endpoint'
|
140
147
|
autoload :ParamConverter, 'aws-sdk-core/plugins/param_converter'
|
141
148
|
autoload :ParamValidator, 'aws-sdk-core/plugins/param_validator'
|
data/lib/aws-sdk-core/client.rb
CHANGED
@@ -0,0 +1,249 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Log
|
5
|
+
|
6
|
+
# A log formatter generates a string for logging from a response. This
|
7
|
+
# accomplished with a log pattern string:
|
8
|
+
#
|
9
|
+
# pattern = ':operation :http_response_status_code :time'
|
10
|
+
# formatter = Aws::Log::Formatter.new(pattern)
|
11
|
+
# formatter.format(response)
|
12
|
+
# #=> 'get_bucket 200 0.0352'
|
13
|
+
#
|
14
|
+
# # Canned Formatters
|
15
|
+
#
|
16
|
+
# Instead of providing your own pattern, you can choose a canned log
|
17
|
+
# formatter.
|
18
|
+
#
|
19
|
+
# * {Formatter.default}
|
20
|
+
# * {Formatter.colored}
|
21
|
+
# * {Formatter.short}
|
22
|
+
#
|
23
|
+
# # Pattern Substitutions
|
24
|
+
#
|
25
|
+
# You can put any of these placeholders into you pattern.
|
26
|
+
#
|
27
|
+
# * `:client_class` - The name of the client class.
|
28
|
+
#
|
29
|
+
# * `:operation` - The name of the client request method.
|
30
|
+
#
|
31
|
+
# * `:request_params` - The user provided request parameters. Long
|
32
|
+
# strings are truncated/summarized if they exceed the
|
33
|
+
# {#max_string_size}. Other objects are inspected.
|
34
|
+
#
|
35
|
+
# * `:time` - The total time in seconds spent on the
|
36
|
+
# request. This includes client side time spent building
|
37
|
+
# the request and parsing the response.
|
38
|
+
#
|
39
|
+
# * `:retries` - The number of times a client request was retried.
|
40
|
+
#
|
41
|
+
# * `:http_request_method` - The http request verb, e.g., `POST`,
|
42
|
+
# `PUT`, `GET`, etc.
|
43
|
+
#
|
44
|
+
# * `:http_request_endpoint` - The request endpoint. This includes
|
45
|
+
# the scheme, host and port, but not the path.
|
46
|
+
#
|
47
|
+
# * `:http_request_scheme` - This is replaced by `http` or `https`.
|
48
|
+
#
|
49
|
+
# * `:http_request_host` - The host name of the http request
|
50
|
+
# endpoint (e.g. 's3.amazon.com').
|
51
|
+
#
|
52
|
+
# * `:http_request_port` - The port number (e.g. '443' or '80').
|
53
|
+
#
|
54
|
+
# * `:http_request_headers` - The http request headers, inspected.
|
55
|
+
#
|
56
|
+
# * `:http_request_body` - The http request payload.
|
57
|
+
#
|
58
|
+
# * `:http_response_status_code` - The http response status
|
59
|
+
# code, e.g., `200`, `404`, `500`, etc.
|
60
|
+
#
|
61
|
+
# * `:http_response_headers` - The http response headers, inspected.
|
62
|
+
#
|
63
|
+
# * `:http_response_body` - The http response body contents.
|
64
|
+
#
|
65
|
+
# * `:error_class`
|
66
|
+
#
|
67
|
+
# * `:error_message`
|
68
|
+
#
|
69
|
+
class Formatter
|
70
|
+
|
71
|
+
# @param [String] pattern The log format pattern should be a string
|
72
|
+
# and may contain substitutions.
|
73
|
+
#
|
74
|
+
# @option options [Integer] :max_string_size (1000) When summarizing
|
75
|
+
# request parameters, strings longer than this value will be
|
76
|
+
# truncated.
|
77
|
+
#
|
78
|
+
# @option options [Array<Symbol>] :filter A list of parameter
|
79
|
+
# names that should be filtered when logging `:request_params`.
|
80
|
+
#
|
81
|
+
# Formatter.new(pattern, filter: [:password])
|
82
|
+
#
|
83
|
+
# The default list of filtered parameters is documented on the
|
84
|
+
# {ParamFilter} class.
|
85
|
+
#
|
86
|
+
def initialize(pattern, options = {})
|
87
|
+
@pattern = pattern
|
88
|
+
@param_formatter = ParamFormatter.new(options)
|
89
|
+
@param_filter = ParamFilter.new(options)
|
90
|
+
end
|
91
|
+
|
92
|
+
# @return [String]
|
93
|
+
attr_reader :pattern
|
94
|
+
|
95
|
+
# Given a resopnse, this will format a log message and return it as a
|
96
|
+
# string according to {#pattern}.
|
97
|
+
# @param [Seahorse::Client::Response] response
|
98
|
+
# @return [String]
|
99
|
+
def format(response)
|
100
|
+
pattern.gsub(/:(\w+)/) {|sym| send("_#{sym[1..-1]}", response) }
|
101
|
+
end
|
102
|
+
|
103
|
+
# @api private
|
104
|
+
def method_missing(method_name, *args)
|
105
|
+
if method_name.to_s.chars.first == '_'
|
106
|
+
":#{method_name.to_s[1..-1]}"
|
107
|
+
else
|
108
|
+
super
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
def _client_class(response)
|
115
|
+
response.context.client.class.name
|
116
|
+
end
|
117
|
+
|
118
|
+
def _operation(response)
|
119
|
+
response.context.operation_name
|
120
|
+
end
|
121
|
+
|
122
|
+
def _request_params(response)
|
123
|
+
params = response.context.params
|
124
|
+
@param_formatter.summarize(@param_filter.filter(params))
|
125
|
+
end
|
126
|
+
|
127
|
+
def _time(response)
|
128
|
+
duration = response.context[:logging_completed_at] -
|
129
|
+
response.context[:logging_started_at]
|
130
|
+
("%.06f" % duration).sub(/0+$/, '')
|
131
|
+
end
|
132
|
+
|
133
|
+
def _retries(response)
|
134
|
+
response.context.retries
|
135
|
+
end
|
136
|
+
|
137
|
+
def _http_request_endpoint(response)
|
138
|
+
response.context.http_request.endpoint.to_s
|
139
|
+
end
|
140
|
+
|
141
|
+
def _http_request_scheme(response)
|
142
|
+
response.context.http_request.endpoint.scheme
|
143
|
+
end
|
144
|
+
|
145
|
+
def _http_request_host(response)
|
146
|
+
response.context.http_request.endpoint.host
|
147
|
+
end
|
148
|
+
|
149
|
+
def _http_request_port(response)
|
150
|
+
response.context.http_request.endpoint.port.to_s
|
151
|
+
end
|
152
|
+
|
153
|
+
def _http_request_method(response)
|
154
|
+
response.context.http_request.http_method
|
155
|
+
end
|
156
|
+
|
157
|
+
def _http_request_headers(response)
|
158
|
+
response.context.http_request.headers.inspect
|
159
|
+
end
|
160
|
+
|
161
|
+
def _http_request_body(response)
|
162
|
+
@param_formatter.summarize(response.context.http_request.body_contents)
|
163
|
+
end
|
164
|
+
|
165
|
+
def _http_response_status_code(response)
|
166
|
+
response.context.http_response.status_code.to_s
|
167
|
+
end
|
168
|
+
|
169
|
+
def _http_response_headers(response)
|
170
|
+
response.context.http_response.headers.inspect
|
171
|
+
end
|
172
|
+
|
173
|
+
def _http_response_body(response)
|
174
|
+
@param_formatter.summarize(response.context.http_response.body_contents)
|
175
|
+
end
|
176
|
+
|
177
|
+
def _error_class(response)
|
178
|
+
response.error ? response.error.class.name : ''
|
179
|
+
end
|
180
|
+
|
181
|
+
def _error_message(response)
|
182
|
+
response.error ? response.error.message : ''
|
183
|
+
end
|
184
|
+
|
185
|
+
class << self
|
186
|
+
|
187
|
+
# The default log format.
|
188
|
+
# @option (see #initialize)
|
189
|
+
# @example A sample of the default format.
|
190
|
+
#
|
191
|
+
# [ClientClass 200 0.580066 0 retries] list_objects(:bucket_name => 'bucket')
|
192
|
+
#
|
193
|
+
# @return [Formatter]
|
194
|
+
def default(options = {})
|
195
|
+
pattern = []
|
196
|
+
pattern << "[:client_class"
|
197
|
+
pattern << ":http_response_status_code"
|
198
|
+
pattern << ":time"
|
199
|
+
pattern << ":retries retries]"
|
200
|
+
pattern << ":operation(:request_params)"
|
201
|
+
pattern << ":error_class"
|
202
|
+
pattern << ":error_message"
|
203
|
+
Formatter.new(pattern.join(' ') + "\n", options)
|
204
|
+
end
|
205
|
+
|
206
|
+
# The short log format. Similar to default, but it does not
|
207
|
+
# inspect the request params or report on retries.
|
208
|
+
# @option (see #initialize)
|
209
|
+
# @example A sample of the short format
|
210
|
+
#
|
211
|
+
# [ClientClass 200 0.494532] list_buckets
|
212
|
+
#
|
213
|
+
# @return [Formatter]
|
214
|
+
def short(options = {})
|
215
|
+
pattern = []
|
216
|
+
pattern << "[:client_class"
|
217
|
+
pattern << ":http_response_status_code"
|
218
|
+
pattern << ":time]"
|
219
|
+
pattern << ":operation"
|
220
|
+
pattern << ":error_class"
|
221
|
+
Formatter.new(pattern.join(' ') + "\n", options)
|
222
|
+
end
|
223
|
+
|
224
|
+
# The default log format with ANSI colors.
|
225
|
+
# @option (see #initialize)
|
226
|
+
# @example A sample of the colored format (sans the ansi colors).
|
227
|
+
#
|
228
|
+
# [ClientClass 200 0.580066 0 retries] list_objects(:bucket_name => 'bucket')
|
229
|
+
#
|
230
|
+
# @return [Formatter]
|
231
|
+
def colored(options = {})
|
232
|
+
bold = "\x1b[1m"
|
233
|
+
color = "\x1b[34m"
|
234
|
+
reset = "\x1b[0m"
|
235
|
+
pattern = []
|
236
|
+
pattern << "#{bold}#{color}[:client_class"
|
237
|
+
pattern << ":http_response_status_code"
|
238
|
+
pattern << ":time"
|
239
|
+
pattern << ":retries retries]#{reset}#{bold}"
|
240
|
+
pattern << ":operation(:request_params)"
|
241
|
+
pattern << ":error_class"
|
242
|
+
pattern << ":error_message#{reset}"
|
243
|
+
Formatter.new(pattern.join(' ') + "\n", options)
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Seahorse
|
2
|
+
module Client
|
3
|
+
module Logging
|
4
|
+
class Handler < Client::Handler
|
5
|
+
|
6
|
+
# @param [RequestContext] context
|
7
|
+
# @return [Response]
|
8
|
+
def call(context)
|
9
|
+
context[:logging_started_at] = Time.now
|
10
|
+
@handler.call(context).tap do |response|
|
11
|
+
context[:logging_completed_at] = Time.now
|
12
|
+
log(context.config, response)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
# @param [Configuration] config
|
19
|
+
# @param [Response] response
|
20
|
+
# @return [void]
|
21
|
+
def log(config, response)
|
22
|
+
config.logger.send(config.log_level, format(config, response))
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param [Configuration] config
|
26
|
+
# @param [Response] response
|
27
|
+
# @return [String]
|
28
|
+
def format(config, response)
|
29
|
+
config.log_formatter.format(response)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Log
|
5
|
+
class ParamFilter
|
6
|
+
|
7
|
+
# A managed list of sensitive parameters that should be filtered from
|
8
|
+
# logs. This is updated automatically as part of each release. See the
|
9
|
+
# `tasks/sensitive.rake` for more information.
|
10
|
+
#
|
11
|
+
# ** DO NOT EDIT THE FOLLOWING LINE OF CODE **
|
12
|
+
#
|
13
|
+
SENSITIVE = [:admin_contact, :artifact_credentials, :auth_code, :base_32_string_seed, :copy_source_sse_customer_key, :new_password, :old_password, :password, :plaintext, :private_key, :qr_code_png, :registrant_contact, :secret_access_key, :shared_secret, :sse_customer_key, :ssekms_key_id, :tech_contact]
|
14
|
+
|
15
|
+
def initialize(options = {})
|
16
|
+
@filters = Set.new(SENSITIVE + Array(options[:filter]))
|
17
|
+
end
|
18
|
+
|
19
|
+
def filter(value)
|
20
|
+
case value
|
21
|
+
when Struct, Hash then filter_hash(value)
|
22
|
+
when Array then filter_array(value)
|
23
|
+
else value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def filter_hash(values)
|
30
|
+
filtered = {}
|
31
|
+
values.each_pair do |key, value|
|
32
|
+
filtered[key] = @filters.include?(key) ? '[FILTERED]' : filter(value)
|
33
|
+
end
|
34
|
+
filtered
|
35
|
+
end
|
36
|
+
|
37
|
+
def filter_array(values)
|
38
|
+
values.map { |value| filter(value) }
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Log
|
5
|
+
# @api private
|
6
|
+
class ParamFormatter
|
7
|
+
|
8
|
+
# String longer than the max string size are truncated
|
9
|
+
MAX_STRING_SIZE = 1000
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
@max_string_size = options[:max_string_size] || MAX_STRING_SIZE
|
13
|
+
end
|
14
|
+
|
15
|
+
def summarize(value)
|
16
|
+
Hash === value ? summarize_hash(value) : summarize_value(value)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def summarize_hash(hash)
|
22
|
+
hash.keys.first.is_a?(String) ?
|
23
|
+
summarize_string_hash(hash) :
|
24
|
+
summarize_symbol_hash(hash)
|
25
|
+
end
|
26
|
+
|
27
|
+
def summarize_symbol_hash(hash)
|
28
|
+
hash.map do |key,v|
|
29
|
+
"#{key}:#{summarize_value(v)}"
|
30
|
+
end.join(",")
|
31
|
+
end
|
32
|
+
|
33
|
+
def summarize_string_hash(hash)
|
34
|
+
hash.map do |key,v|
|
35
|
+
"#{key.inspect}=>#{summarize_value(v)}"
|
36
|
+
end.join(",")
|
37
|
+
end
|
38
|
+
|
39
|
+
def summarize_string(str)
|
40
|
+
if str.size > @max_string_size
|
41
|
+
"#<String #{str[0...@max_string_size].inspect} ... (#{str.size} bytes)>"
|
42
|
+
else
|
43
|
+
str.inspect
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def summarize_value(value)
|
48
|
+
case value
|
49
|
+
when String then summarize_string(value)
|
50
|
+
when Hash then '{' + summarize_hash(value) + '}'
|
51
|
+
when Array then summarize_array(value)
|
52
|
+
when File then summarize_file(value.path)
|
53
|
+
when Pathname then summarize_file(value)
|
54
|
+
else value.inspect
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def summarize_file(path)
|
59
|
+
"#<File:#{path} (#{File.size(path)} bytes)>"
|
60
|
+
end
|
61
|
+
|
62
|
+
def summarize_array(array)
|
63
|
+
"[" + array.map{|v| summarize_value(v) }.join(",") + "]"
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Aws
|
2
|
+
module Plugins
|
3
|
+
|
4
|
+
# Enables logging for all requests. This plugin allows you to configure
|
5
|
+
# your logging device, the log format and the level to log messages at.
|
6
|
+
#
|
7
|
+
# @see Log::Formatter
|
8
|
+
#
|
9
|
+
# @seahorse.client.option [Logger] :logger (nil) The Logger instance
|
10
|
+
# to send log messages to. If this option is not set, logging
|
11
|
+
# will be disabled.
|
12
|
+
#
|
13
|
+
# @seahorse.client.option [Symbol] :log_level (:info) The log level
|
14
|
+
# to send messages to the logger at.
|
15
|
+
#
|
16
|
+
# @seahorse.client.option [Logging::LogFormatter] :log_formatter The log
|
17
|
+
# formatter. Defaults to {Seahorse::Client::Logging::Formatter.default}.
|
18
|
+
#
|
19
|
+
class Logging < Seahorse::Client::Plugin
|
20
|
+
|
21
|
+
option(:logger)
|
22
|
+
|
23
|
+
option(:log_level, :info)
|
24
|
+
|
25
|
+
option(:log_formatter) do |config|
|
26
|
+
Log::Formatter.default if config.logger
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_handlers(handlers, config)
|
30
|
+
handlers.add(Handler, step: :validate) if config.logger
|
31
|
+
end
|
32
|
+
|
33
|
+
class Handler < Seahorse::Client::Handler
|
34
|
+
|
35
|
+
# @param [RequestContext] context
|
36
|
+
# @return [Response]
|
37
|
+
def call(context)
|
38
|
+
context[:logging_started_at] = Time.now
|
39
|
+
@handler.call(context).tap do |response|
|
40
|
+
context[:logging_completed_at] = Time.now
|
41
|
+
log(context.config, response)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
# @param [Configuration] config
|
48
|
+
# @param [Response] response
|
49
|
+
# @return [void]
|
50
|
+
def log(config, response)
|
51
|
+
config.logger.send(config.log_level, format(config, response))
|
52
|
+
end
|
53
|
+
|
54
|
+
# @param [Configuration] config
|
55
|
+
# @param [Response] response
|
56
|
+
# @return [String]
|
57
|
+
def format(config, response)
|
58
|
+
config.log_formatter.format(response)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/aws-sdk-core/version.rb
CHANGED
data/lib/seahorse.rb
CHANGED
@@ -25,6 +25,8 @@ module Seahorse
|
|
25
25
|
autoload :Response, 'seahorse/client/http/response'
|
26
26
|
end
|
27
27
|
|
28
|
+
# The following module has been deprecated.
|
29
|
+
# @api private
|
28
30
|
module Logging
|
29
31
|
autoload :Handler, 'seahorse/client/logging/handler'
|
30
32
|
autoload :Formatter, 'seahorse/client/logging/formatter'
|
@@ -57,6 +57,12 @@ module Seahorse
|
|
57
57
|
(200..299).include?(@context.http_response.status_code) && @error.nil?
|
58
58
|
end
|
59
59
|
|
60
|
+
# @api private
|
61
|
+
def on_complete(&block)
|
62
|
+
@context.http_response.on_done(&block)
|
63
|
+
self
|
64
|
+
end
|
65
|
+
|
60
66
|
# @api private
|
61
67
|
def inspect
|
62
68
|
@data.inspect
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|
@@ -228,6 +228,10 @@ files:
|
|
228
228
|
- lib/aws-sdk-core/kms.rb
|
229
229
|
- lib/aws-sdk-core/lambda.rb
|
230
230
|
- lib/aws-sdk-core/lambdapreview.rb
|
231
|
+
- lib/aws-sdk-core/log/formatter.rb
|
232
|
+
- lib/aws-sdk-core/log/handler.rb
|
233
|
+
- lib/aws-sdk-core/log/param_filter.rb
|
234
|
+
- lib/aws-sdk-core/log/param_formatter.rb
|
231
235
|
- lib/aws-sdk-core/machinelearning.rb
|
232
236
|
- lib/aws-sdk-core/opsworks.rb
|
233
237
|
- lib/aws-sdk-core/pageable_response.rb
|
@@ -243,6 +247,7 @@ files:
|
|
243
247
|
- lib/aws-sdk-core/plugins/glacier_api_version.rb
|
244
248
|
- lib/aws-sdk-core/plugins/glacier_checksums.rb
|
245
249
|
- lib/aws-sdk-core/plugins/global_configuration.rb
|
250
|
+
- lib/aws-sdk-core/plugins/logging.rb
|
246
251
|
- lib/aws-sdk-core/plugins/machine_learning_predict_endpoint.rb
|
247
252
|
- lib/aws-sdk-core/plugins/param_converter.rb
|
248
253
|
- lib/aws-sdk-core/plugins/param_validator.rb
|
@@ -399,7 +404,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
399
404
|
version: '0'
|
400
405
|
requirements: []
|
401
406
|
rubyforge_project:
|
402
|
-
rubygems_version: 2.
|
407
|
+
rubygems_version: 2.4.6
|
403
408
|
signing_key:
|
404
409
|
specification_version: 4
|
405
410
|
summary: AWS SDK for Ruby - Core
|