aws-sdk-core 3.25.0 → 3.26.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/VERSION +1 -1
- data/lib/aws-sdk-core.rb +5 -0
- data/lib/aws-sdk-core/client_side_monitoring/publisher.rb +41 -0
- data/lib/aws-sdk-core/client_side_monitoring/request_metrics.rb +134 -0
- data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +217 -0
- data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +80 -0
- data/lib/aws-sdk-core/plugins/stub_responses.rb +3 -0
- data/lib/aws-sdk-core/shared_config.rb +45 -0
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +21 -1
- data/lib/aws-sdk-sts/client_api.rb +5 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 240dcbe7991695e3ab43cff4e324c7b3e9c3019e
|
4
|
+
data.tar.gz: e961adb158d2db9e5da20424029e39e16d171456
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09e1eb6311517fb8dec01acb21beafcdeb4d46bfbdcfb21e4e1654e40ea2b8cfcc93e65a3870b2b2a10bbdc333c1ba9e03b8072ccdd25e7c9070fb2a7a759092'
|
7
|
+
data.tar.gz: cf0cba175b8b4dc5d5053048026ff1c606077021ea0dcdb2df3404ca888aa5b2d3e0c5185caa6c1311fd03bb0515e13717f2b03ab6c2efe10ecdb2020afeb93f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.26.0
|
data/lib/aws-sdk-core.rb
CHANGED
@@ -67,6 +67,11 @@ require_relative 'aws-sdk-core/json'
|
|
67
67
|
require_relative 'aws-sdk-core/binary'
|
68
68
|
require_relative 'aws-sdk-core/event_emitter'
|
69
69
|
|
70
|
+
# client metrics
|
71
|
+
|
72
|
+
require_relative 'aws-sdk-core/client_side_monitoring/request_metrics'
|
73
|
+
require_relative 'aws-sdk-core/client_side_monitoring/publisher'
|
74
|
+
|
70
75
|
# aws-sdk-sts is vendored to support Aws::AssumeRoleCredentials
|
71
76
|
|
72
77
|
require 'aws-sdk-sts'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'thread'
|
2
|
+
require 'socket'
|
3
|
+
|
4
|
+
module Aws
|
5
|
+
module ClientSideMonitoring
|
6
|
+
# @api private
|
7
|
+
class Publisher
|
8
|
+
attr_reader :agent_port
|
9
|
+
|
10
|
+
def initialize(opts = {})
|
11
|
+
@agent_port = opts[:agent_port]
|
12
|
+
@mutex = Mutex.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def agent_port=(value)
|
16
|
+
@mutex.synchronize do
|
17
|
+
@agent_port = value
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def publish(request_metrics)
|
22
|
+
send_datagram(request_metrics.api_call.to_json)
|
23
|
+
request_metrics.api_call_attempts.each do |attempt|
|
24
|
+
send_datagram(attempt.to_json)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def send_datagram(msg)
|
29
|
+
if @agent_port
|
30
|
+
socket = UDPSocket.new
|
31
|
+
begin
|
32
|
+
socket.connect("127.0.0.1", @agent_port)
|
33
|
+
socket.send(msg, 0)
|
34
|
+
rescue Errno::ECONNREFUSED
|
35
|
+
# Drop on the floor
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
module Aws
|
2
|
+
module ClientSideMonitoring
|
3
|
+
# @api private
|
4
|
+
class RequestMetrics
|
5
|
+
attr_reader :api_call, :api_call_attempts
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
@service = opts[:service]
|
9
|
+
@api = opts[:operation]
|
10
|
+
@client_id = opts[:client_id]
|
11
|
+
@timestamp = opts[:timestamp] # In epoch milliseconds
|
12
|
+
@version = 1
|
13
|
+
@api_call = ApiCall.new(@service, @api, @client_id, @version, @timestamp)
|
14
|
+
@api_call_attempts = []
|
15
|
+
end
|
16
|
+
|
17
|
+
def build_call_attempt(opts = {})
|
18
|
+
timestamp = opts[:timestamp]
|
19
|
+
fqdn = opts[:fqdn]
|
20
|
+
region = opts[:region]
|
21
|
+
user_agent = opts[:user_agent]
|
22
|
+
access_key = opts[:access_key]
|
23
|
+
session_token = opts[:session_token]
|
24
|
+
ApiCallAttempt.new(
|
25
|
+
@service,
|
26
|
+
@api,
|
27
|
+
@client_id,
|
28
|
+
@version,
|
29
|
+
timestamp,
|
30
|
+
fqdn,
|
31
|
+
region,
|
32
|
+
user_agent,
|
33
|
+
access_key,
|
34
|
+
session_token
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_call_attempt(attempt)
|
39
|
+
@api_call_attempts << attempt
|
40
|
+
end
|
41
|
+
|
42
|
+
class ApiCall
|
43
|
+
attr_reader :service, :api, :client_id, :timestamp, :version,
|
44
|
+
:attempt_count, :latency
|
45
|
+
|
46
|
+
def initialize(service, api, client_id, version, timestamp)
|
47
|
+
@service = service
|
48
|
+
@api = api
|
49
|
+
@client_id = client_id
|
50
|
+
@version = version
|
51
|
+
@timestamp = timestamp
|
52
|
+
end
|
53
|
+
|
54
|
+
def complete(opts = {})
|
55
|
+
@latency = opts[:latency]
|
56
|
+
@attempt_count = opts[:attempt_count]
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_json(*a)
|
60
|
+
{
|
61
|
+
"Type" => "ApiCall",
|
62
|
+
"Service" => @service,
|
63
|
+
"Api" => @api,
|
64
|
+
"ClientId" => @client_id,
|
65
|
+
"Timestamp" => @timestamp,
|
66
|
+
"Version" => @version,
|
67
|
+
"AttemptCount" => @attempt_count,
|
68
|
+
"Latency" => @latency
|
69
|
+
}.to_json
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class ApiCallAttempt
|
74
|
+
attr_reader :service, :api, :client_id, :version, :timestamp, :fqdn,
|
75
|
+
:region, :user_agent, :access_key, :session_token
|
76
|
+
attr_accessor :request_latency, :http_status_code, :aws_exception_msg,
|
77
|
+
:x_amz_request_id, :x_amz_id_2, :x_amzn_request_id, :sdk_exception,
|
78
|
+
:aws_exception, :sdk_exception_msg
|
79
|
+
|
80
|
+
def initialize(
|
81
|
+
service,
|
82
|
+
api,
|
83
|
+
client_id,
|
84
|
+
version,
|
85
|
+
timestamp,
|
86
|
+
fqdn,
|
87
|
+
region,
|
88
|
+
user_agent,
|
89
|
+
access_key,
|
90
|
+
session_token
|
91
|
+
)
|
92
|
+
@service = service
|
93
|
+
@api = api
|
94
|
+
@client_id = client_id
|
95
|
+
@version = version
|
96
|
+
@timestamp = timestamp
|
97
|
+
@fqdn = fqdn
|
98
|
+
@region = region
|
99
|
+
@user_agent = user_agent
|
100
|
+
@access_key = access_key
|
101
|
+
@session_token = session_token
|
102
|
+
end
|
103
|
+
|
104
|
+
def to_json(*a)
|
105
|
+
json = {
|
106
|
+
"Type" => "ApiCallAttempt",
|
107
|
+
"Service" => @service,
|
108
|
+
"Api" => @api,
|
109
|
+
"ClientId" => @client_id,
|
110
|
+
"Timestamp" => @timestamp,
|
111
|
+
"Version" => @version,
|
112
|
+
"Fqdn" => @fqdn,
|
113
|
+
"Region" => @region,
|
114
|
+
"UserAgent" => @user_agent,
|
115
|
+
"AccessKey" => @access_key
|
116
|
+
}
|
117
|
+
# Optional Fields
|
118
|
+
json["SessionToken"] = @session_token if @session_token
|
119
|
+
json["HttpStatusCode"] = @http_status_code if @http_status_code
|
120
|
+
json["AwsException"] = @aws_exception if @aws_exception
|
121
|
+
json["AwsExceptionMessage"] = @aws_exception_msg if @aws_exception_msg
|
122
|
+
json["XAmznRequestId"] = @x_amzn_request_id if @x_amzn_request_id
|
123
|
+
json["XAmzRequestId"] = @x_amz_request_id if @x_amz_request_id
|
124
|
+
json["XAmzId2"] = @x_amz_id_2 if @x_amz_id_2
|
125
|
+
json["AttemptLatency"] = @request_latency if @request_latency
|
126
|
+
json["SdkException"] = @sdk_exception if @sdk_exception
|
127
|
+
json["SdkExceptionMessage"] = @sdk_exception_msg if @sdk_exception_msg
|
128
|
+
json.to_json
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,217 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Plugins
|
5
|
+
class ClientMetricsPlugin < Seahorse::Client::Plugin
|
6
|
+
|
7
|
+
option(:client_side_monitoring,
|
8
|
+
default: false,
|
9
|
+
docstring: <<-DOCS) do |cfg|
|
10
|
+
When `true`, client-side metrics will be collected for all API requests from
|
11
|
+
this client.
|
12
|
+
DOCS
|
13
|
+
resolve_client_side_monitoring(cfg)
|
14
|
+
end
|
15
|
+
|
16
|
+
option(:client_side_monitoring_port,
|
17
|
+
default: 31000,
|
18
|
+
docstring: <<-DOCS) do |cfg|
|
19
|
+
Required for publishing client metrics. The port that the client side monitoring
|
20
|
+
agent is running on, where client metrics will be published via UDP.
|
21
|
+
DOCS
|
22
|
+
resolve_client_side_monitoring_port(cfg)
|
23
|
+
end
|
24
|
+
|
25
|
+
option(:client_side_monitoring_publisher,
|
26
|
+
default: ClientSideMonitoring::Publisher.new,
|
27
|
+
docstring: <<-DOCS)
|
28
|
+
Allows you to provide a custom client-side monitoring publisher class. By default,
|
29
|
+
will use the Client Side Monitoring Agent Publisher.
|
30
|
+
DOCS
|
31
|
+
|
32
|
+
option(:client_side_monitoring_client_id,
|
33
|
+
default: "",
|
34
|
+
docstring: <<-DOCS) do |cfg|
|
35
|
+
Allows you to provide an identifier for this client which will be attached to
|
36
|
+
all generated client side metrics. Defaults to an empty string.
|
37
|
+
DOCS
|
38
|
+
resolve_client_id(cfg)
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_handlers(handlers, config)
|
42
|
+
if config.client_side_monitoring && config.client_side_monitoring_port
|
43
|
+
handlers.add(Handler, step: :initialize)
|
44
|
+
publisher = config.client_side_monitoring_publisher
|
45
|
+
publisher.agent_port = config.client_side_monitoring_port
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
def self.resolve_client_side_monitoring_port(cfg)
|
51
|
+
env_source = ENV["AWS_CSM_PORT"]
|
52
|
+
env_source = nil if env_source == ""
|
53
|
+
cfg_source = Aws.shared_config.csm_port(profile: cfg.profile)
|
54
|
+
if env_source
|
55
|
+
env_source.to_i
|
56
|
+
elsif cfg_source
|
57
|
+
cfg_source.to_i
|
58
|
+
else
|
59
|
+
31000
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.resolve_client_side_monitoring(cfg)
|
64
|
+
env_source = ENV["AWS_CSM_ENABLED"]
|
65
|
+
env_source = nil if env_source == ""
|
66
|
+
if env_source.is_a?(String) && (env_source.downcase == "false" || env_source.downcase == "f")
|
67
|
+
env_source = false
|
68
|
+
end
|
69
|
+
cfg_source = Aws.shared_config.csm_enabled(profile: cfg.profile)
|
70
|
+
if env_source || cfg_source
|
71
|
+
true
|
72
|
+
else
|
73
|
+
false
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.resolve_client_id(cfg)
|
78
|
+
default = ""
|
79
|
+
env_source = ENV["AWS_CSM_CLIENT_ID"]
|
80
|
+
env_source = nil if env_source == ""
|
81
|
+
cfg_source = Aws.shared_config.csm_client_id(profile: cfg.profile)
|
82
|
+
env_source || cfg_source || default
|
83
|
+
end
|
84
|
+
|
85
|
+
class Handler < Seahorse::Client::Handler
|
86
|
+
def call(context)
|
87
|
+
publisher = context.config.client_side_monitoring_publisher
|
88
|
+
service_id = context.config.api.metadata["serviceId"]
|
89
|
+
# serviceId not present in all versions, need a fallback
|
90
|
+
service_id ||= _calculate_service_id(context)
|
91
|
+
|
92
|
+
request_metrics = ClientSideMonitoring::RequestMetrics.new(
|
93
|
+
service: service_id,
|
94
|
+
operation: context.operation.name,
|
95
|
+
client_id: context.config.client_side_monitoring_client_id,
|
96
|
+
timestamp: DateTime.now.strftime('%Q').to_i,
|
97
|
+
)
|
98
|
+
context.metadata[:client_metrics] = request_metrics
|
99
|
+
start_time = Time.now
|
100
|
+
begin
|
101
|
+
@handler.call(context)
|
102
|
+
rescue StandardError => e
|
103
|
+
# Handle SDK Exceptions
|
104
|
+
if request_metrics.api_call_attempts.empty?
|
105
|
+
attempt = request_metrics.build_call_attempt
|
106
|
+
attempt.sdk_exception = e.class.to_s
|
107
|
+
attempt.sdk_exception_msg = e.message
|
108
|
+
request_metrics.add_call_attempt(attempt)
|
109
|
+
elsif request_metrics.api_call_attempts.last.aws_exception.nil?
|
110
|
+
# Handle exceptions during response handlers
|
111
|
+
attempt = request_metrics.api_call_attempts.last
|
112
|
+
attempt.sdk_exception = e.class.to_s
|
113
|
+
attempt.sdk_exception_msg = e.message
|
114
|
+
elsif !e.class.to_s.match(request_metrics.api_call_attempts.last.aws_exception)
|
115
|
+
# Handle response handling exceptions that happened in addition to
|
116
|
+
# an AWS exception
|
117
|
+
attempt = request_metrics.api_call_attempts.last
|
118
|
+
attempt.sdk_exception = e.class.to_s
|
119
|
+
attempt.sdk_exception_msg = e.message
|
120
|
+
end # Else we don't have an SDK exception and are done.
|
121
|
+
raise e
|
122
|
+
ensure
|
123
|
+
end_time = Time.now
|
124
|
+
request_metrics.api_call.complete(
|
125
|
+
latency: ((end_time - start_time) * 1000).to_i,
|
126
|
+
attempt_count: context.retries + 1
|
127
|
+
)
|
128
|
+
# Report the metrics by passing the complete RequestMetrics object
|
129
|
+
if publisher
|
130
|
+
publisher.publish(request_metrics)
|
131
|
+
end # Else we drop all this on the floor.
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
private
|
136
|
+
def _calculate_service_id(context)
|
137
|
+
class_name = context.client.class.to_s.match(/(.+)::Client/)[1]
|
138
|
+
class_name.sub!(/^Aws::/, '')
|
139
|
+
_fallback_service_id(class_name)
|
140
|
+
end
|
141
|
+
|
142
|
+
def _fallback_service_id(id)
|
143
|
+
# Need hard-coded exceptions since information needed to
|
144
|
+
# reverse-engineer serviceId is not present in older versions.
|
145
|
+
# This list should not need to grow.
|
146
|
+
exceptions = {
|
147
|
+
"ACMPCA" => "ACM PCA",
|
148
|
+
"APIGateway" => "API Gateway",
|
149
|
+
"AlexaForBusiness" => "Alexa For Business",
|
150
|
+
"ApplicationAutoScaling" => "Application Auto Scaling",
|
151
|
+
"ApplicationDiscoveryService" => "Application Discovery Service",
|
152
|
+
"AutoScaling" => "Auto Scaling",
|
153
|
+
"AutoScalingPlans" => "Auto Scaling Plans",
|
154
|
+
"CloudHSMV2" => "CloudHSM V2",
|
155
|
+
"CloudSearchDomain" => "CloudSearch Domain",
|
156
|
+
"CloudWatchEvents" => "CloudWatch Events",
|
157
|
+
"CloudWatchLogs" => "CloudWatch Logs",
|
158
|
+
"CognitoIdentity" => "Cognito Identity",
|
159
|
+
"CognitoIdentityProvider" => "Cognito Identity Provider",
|
160
|
+
"CognitoSync" => "Cognito Sync",
|
161
|
+
"ConfigService" => "Config Service",
|
162
|
+
"CostExplorer" => "Cost Explorer",
|
163
|
+
"CostandUsageReportService" => "Cost and Usage Report Service",
|
164
|
+
"DataPipeline" => "Data Pipeline",
|
165
|
+
"DatabaseMigrationService" => "Database Migration Service",
|
166
|
+
"DeviceFarm" => "Device Farm",
|
167
|
+
"DirectConnect" => "Direct Connect",
|
168
|
+
"DirectoryService" => "Directory Service",
|
169
|
+
"DynamoDBStreams" => "DynamoDB Streams",
|
170
|
+
"ElasticBeanstalk" => "Elastic Beanstalk",
|
171
|
+
"ElasticLoadBalancing" => "Elastic Load Balancing",
|
172
|
+
"ElasticLoadBalancingV2" => "Elastic Load Balancing v2",
|
173
|
+
"ElasticTranscoder" => "Elastic Transcoder",
|
174
|
+
"ElasticsearchService" => "Elasticsearch Service",
|
175
|
+
"IoTDataPlane" => "IoT Data Plane",
|
176
|
+
"IoTJobsDataPlane" => "IoT Jobs Data Plane",
|
177
|
+
"IoT1ClickDevicesService" => "IoT 1Click Devices Service",
|
178
|
+
"IoT1ClickProjects" => "IoT 1Click Projects",
|
179
|
+
"KinesisAnalytics" => "Kinesis Analytics",
|
180
|
+
"KinesisVideo" => "Kinesis Video",
|
181
|
+
"KinesisVideoArchivedMedia" => "Kinesis Video Archived Media",
|
182
|
+
"KinesisVideoMedia" => "Kinesis Video Media",
|
183
|
+
"LambdaPreview" => "Lambda",
|
184
|
+
"Lex" => "Lex Runtime Service",
|
185
|
+
"LexModelBuildingService" => "Lex Model Building Service",
|
186
|
+
"Lightsail" => "Lightsail",
|
187
|
+
"MQ" => "mq",
|
188
|
+
"MachineLearning" => "Machine Learning",
|
189
|
+
"MarketplaceCommerceAnalytics" => "Marketplace Commerce Analytics",
|
190
|
+
"MarketplaceEntitlementService" => "Marketplace Entitlement Service",
|
191
|
+
"MarketplaceMetering" => "Marketplace Metering",
|
192
|
+
"MediaStoreData" => "MediaStore Data",
|
193
|
+
"MigrationHub" => "Migration Hub",
|
194
|
+
"ResourceGroups" => "Resource Groups",
|
195
|
+
"ResourceGroupsTaggingAPI" => "Resource Groups Tagging API",
|
196
|
+
"Route53" => "Route 53",
|
197
|
+
"Route53Domains" => "Route 53 Domains",
|
198
|
+
"SecretsManager" => "Secrets Manager",
|
199
|
+
"SageMakerRuntime" => "SageMaker Runtime",
|
200
|
+
"ServiceCatalog" => "Service Catalog",
|
201
|
+
"ServiceDiscovery" => "ServiceDiscovery",
|
202
|
+
"Signer" => "signer",
|
203
|
+
"States" => "SFN",
|
204
|
+
"StorageGateway" => "Storage Gateway",
|
205
|
+
"TranscribeService" => "Transcribe Service",
|
206
|
+
"WAFRegional" => "WAF Regional",
|
207
|
+
}
|
208
|
+
if exceptions[id]
|
209
|
+
exceptions[id]
|
210
|
+
else
|
211
|
+
id
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Plugins
|
5
|
+
class ClientMetricsSendPlugin < Seahorse::Client::Plugin
|
6
|
+
|
7
|
+
def add_handlers(handlers, config)
|
8
|
+
if config.client_side_monitoring && config.client_side_monitoring_port
|
9
|
+
# AttemptHandler comes just before we would retry an error.
|
10
|
+
handlers.add(AttemptHandler, step: :sign, priority: 95)
|
11
|
+
# LatencyHandler is as close to sending as possible.
|
12
|
+
handlers.add(LatencyHandler, step: :sign, priority: 0)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class LatencyHandler < Seahorse::Client::Handler
|
17
|
+
def call(context)
|
18
|
+
start_time = Time.now
|
19
|
+
resp = @handler.call(context)
|
20
|
+
end_time = Time.now
|
21
|
+
latency = ((end_time - start_time) * 1000).to_i
|
22
|
+
context.metadata[:current_call_attempt].request_latency = latency
|
23
|
+
resp
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class AttemptHandler < Seahorse::Client::Handler
|
28
|
+
def call(context)
|
29
|
+
request_metrics = context.metadata[:client_metrics]
|
30
|
+
attempt_opts = {
|
31
|
+
timestamp: DateTime.now.strftime('%Q').to_i,
|
32
|
+
fqdn: context.http_request.endpoint.host,
|
33
|
+
region: context.config.region,
|
34
|
+
user_agent: context.http_request.headers["user-agent"],
|
35
|
+
}
|
36
|
+
# It will generally cause an error, but it is semantically valid for
|
37
|
+
# credentials to not exist.
|
38
|
+
if context.config.credentials
|
39
|
+
attempt_opts[:access_key] =
|
40
|
+
context.config.credentials.credentials.access_key_id
|
41
|
+
attempt_opts[:session_token] =
|
42
|
+
context.config.credentials.credentials.session_token
|
43
|
+
end
|
44
|
+
call_attempt = request_metrics.build_call_attempt(attempt_opts)
|
45
|
+
context.metadata[:current_call_attempt] = call_attempt
|
46
|
+
|
47
|
+
resp = @handler.call(context)
|
48
|
+
headers = context.http_response.headers
|
49
|
+
if headers.include?("x-amz-id-2")
|
50
|
+
call_attempt.x_amz_id_2 = headers["x-amz-id-2"]
|
51
|
+
end
|
52
|
+
if headers.include?("x-amz-request-id")
|
53
|
+
call_attempt.x_amz_request_id = headers["x-amz-request-id"]
|
54
|
+
end
|
55
|
+
if headers.include?("x-amzn-request-id")
|
56
|
+
call_attempt.x_amzn_request_id = headers["x-amzn-request-id"]
|
57
|
+
end
|
58
|
+
call_attempt.http_status_code = context.http_response.status_code
|
59
|
+
if e = resp.error
|
60
|
+
e_name = _extract_error_name(e)
|
61
|
+
e_msg = e.message
|
62
|
+
call_attempt.aws_exception = "#{e_name}"
|
63
|
+
call_attempt.aws_exception_msg = "#{e_msg}"
|
64
|
+
end
|
65
|
+
request_metrics.add_call_attempt(call_attempt)
|
66
|
+
resp
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
def _extract_error_name(error)
|
71
|
+
if error.is_a?(Aws::Errors::ServiceError)
|
72
|
+
error.class.code
|
73
|
+
else
|
74
|
+
error.class.name.to_s
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -34,6 +34,9 @@ requests are made, and retries are disabled.
|
|
34
34
|
if client.config.stub_responses
|
35
35
|
client.setup_stubbing
|
36
36
|
client.handlers.remove(RetryErrors::Handler)
|
37
|
+
client.handlers.remove(ClientMetricsPlugin::Handler)
|
38
|
+
client.handlers.remove(ClientMetricsSendPlugin::LatencyHandler)
|
39
|
+
client.handlers.remove(ClientMetricsSendPlugin::AttemptHandler)
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
@@ -140,6 +140,51 @@ module Aws
|
|
140
140
|
@parsed_config[profile]['credential_process']
|
141
141
|
end
|
142
142
|
|
143
|
+
def csm_enabled(opts = {})
|
144
|
+
p = opts[:profile] || @profile_name
|
145
|
+
if @config_enabled
|
146
|
+
if @parsed_credentials
|
147
|
+
value = @parsed_credentials.fetch(p, {})["csm_enabled"]
|
148
|
+
end
|
149
|
+
if @parsed_config
|
150
|
+
value ||= @parsed_config.fetch(p, {})["csm_enabled"]
|
151
|
+
end
|
152
|
+
value
|
153
|
+
else
|
154
|
+
nil
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def csm_client_id(opts = {})
|
159
|
+
p = opts[:profile] || @profile_name
|
160
|
+
if @config_enabled
|
161
|
+
if @parsed_credentials
|
162
|
+
value = @parsed_credentials.fetch(p, {})["csm_client_id"]
|
163
|
+
end
|
164
|
+
if @parsed_config
|
165
|
+
value ||= @parsed_config.fetch(p, {})["csm_client_id"]
|
166
|
+
end
|
167
|
+
value
|
168
|
+
else
|
169
|
+
nil
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def csm_port(opts = {})
|
174
|
+
p = opts[:profile] || @profile_name
|
175
|
+
if @config_enabled
|
176
|
+
if @parsed_credentials
|
177
|
+
value = @parsed_credentials.fetch(p, {})["csm_port"]
|
178
|
+
end
|
179
|
+
if @parsed_config
|
180
|
+
value ||= @parsed_config.fetch(p, {})["csm_port"]
|
181
|
+
end
|
182
|
+
value
|
183
|
+
else
|
184
|
+
nil
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
143
188
|
private
|
144
189
|
def credentials_present?
|
145
190
|
(@parsed_credentials && !@parsed_credentials.empty?) ||
|
data/lib/aws-sdk-sts.rb
CHANGED
data/lib/aws-sdk-sts/client.rb
CHANGED
@@ -19,6 +19,8 @@ require 'aws-sdk-core/plugins/response_paging.rb'
|
|
19
19
|
require 'aws-sdk-core/plugins/stub_responses.rb'
|
20
20
|
require 'aws-sdk-core/plugins/idempotency_token.rb'
|
21
21
|
require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
|
22
|
+
require 'aws-sdk-core/plugins/client_metrics_plugin.rb'
|
23
|
+
require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb'
|
22
24
|
require 'aws-sdk-core/plugins/signature_v4.rb'
|
23
25
|
require 'aws-sdk-core/plugins/protocols/query.rb'
|
24
26
|
|
@@ -47,6 +49,8 @@ module Aws::STS
|
|
47
49
|
add_plugin(Aws::Plugins::StubResponses)
|
48
50
|
add_plugin(Aws::Plugins::IdempotencyToken)
|
49
51
|
add_plugin(Aws::Plugins::JsonvalueConverter)
|
52
|
+
add_plugin(Aws::Plugins::ClientMetricsPlugin)
|
53
|
+
add_plugin(Aws::Plugins::ClientMetricsSendPlugin)
|
50
54
|
add_plugin(Aws::Plugins::SignatureV4)
|
51
55
|
add_plugin(Aws::Plugins::Protocols::Query)
|
52
56
|
|
@@ -92,6 +96,22 @@ module Aws::STS
|
|
92
96
|
#
|
93
97
|
# @option options [String] :access_key_id
|
94
98
|
#
|
99
|
+
# @option options [] :client_side_monitoring (false)
|
100
|
+
# When `true`, client-side metrics will be collected for all API requests from
|
101
|
+
# this client.
|
102
|
+
#
|
103
|
+
# @option options [] :client_side_monitoring_client_id ("")
|
104
|
+
# Allows you to provide an identifier for this client which will be attached to
|
105
|
+
# all generated client side metrics. Defaults to an empty string.
|
106
|
+
#
|
107
|
+
# @option options [] :client_side_monitoring_port (31000)
|
108
|
+
# Required for publishing client metrics. The port that the client side monitoring
|
109
|
+
# agent is running on, where client metrics will be published via UDP.
|
110
|
+
#
|
111
|
+
# @option options [] :client_side_monitoring_publisher (#<Aws::ClientSideMonitoring::Publisher:0x00007f20e3c7b9f0 @agent_port=nil, @mutex=#<Thread::Mutex:0x00007f20e3c7b9a0>>)
|
112
|
+
# Allows you to provide a custom client-side monitoring publisher class. By default,
|
113
|
+
# will use the Client Side Monitoring Agent Publisher.
|
114
|
+
#
|
95
115
|
# @option options [Boolean] :convert_params (true)
|
96
116
|
# When `true`, an attempt is made to coerce request parameters into
|
97
117
|
# the required types.
|
@@ -1486,7 +1506,7 @@ module Aws::STS
|
|
1486
1506
|
params: params,
|
1487
1507
|
config: config)
|
1488
1508
|
context[:gem_name] = 'aws-sdk-core'
|
1489
|
-
context[:gem_version] = '3.
|
1509
|
+
context[:gem_version] = '3.26.0'
|
1490
1510
|
Seahorse::Client::Request.new(handlers, context)
|
1491
1511
|
end
|
1492
1512
|
|
@@ -173,10 +173,15 @@ module Aws::STS
|
|
173
173
|
api.version = "2011-06-15"
|
174
174
|
|
175
175
|
api.metadata = {
|
176
|
+
"apiVersion" => "2011-06-15",
|
176
177
|
"endpointPrefix" => "sts",
|
178
|
+
"globalEndpoint" => "sts.amazonaws.com",
|
177
179
|
"protocol" => "query",
|
180
|
+
"serviceAbbreviation" => "AWS STS",
|
178
181
|
"serviceFullName" => "AWS Security Token Service",
|
182
|
+
"serviceId" => "STS",
|
179
183
|
"signatureVersion" => "v4",
|
184
|
+
"uid" => "sts-2011-06-15",
|
180
185
|
"xmlNamespace" => "https://sts.amazonaws.com/doc/2011-06-15/",
|
181
186
|
}
|
182
187
|
|
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: 3.
|
4
|
+
version: 3.26.0
|
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: 2018-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|
@@ -81,6 +81,8 @@ files:
|
|
81
81
|
- lib/aws-sdk-core/binary/decode_handler.rb
|
82
82
|
- lib/aws-sdk-core/binary/event_parser.rb
|
83
83
|
- lib/aws-sdk-core/binary/event_stream_decoder.rb
|
84
|
+
- lib/aws-sdk-core/client_side_monitoring/publisher.rb
|
85
|
+
- lib/aws-sdk-core/client_side_monitoring/request_metrics.rb
|
84
86
|
- lib/aws-sdk-core/client_stubs.rb
|
85
87
|
- lib/aws-sdk-core/credential_provider.rb
|
86
88
|
- lib/aws-sdk-core/credential_provider_chain.rb
|
@@ -111,6 +113,8 @@ files:
|
|
111
113
|
- lib/aws-sdk-core/plugins/apig_authorizer_token.rb
|
112
114
|
- lib/aws-sdk-core/plugins/apig_credentials_configuration.rb
|
113
115
|
- lib/aws-sdk-core/plugins/apig_user_agent.rb
|
116
|
+
- lib/aws-sdk-core/plugins/client_metrics_plugin.rb
|
117
|
+
- lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb
|
114
118
|
- lib/aws-sdk-core/plugins/credentials_configuration.rb
|
115
119
|
- lib/aws-sdk-core/plugins/event_stream_configuration.rb
|
116
120
|
- lib/aws-sdk-core/plugins/global_configuration.rb
|