aws-sdk-sqs 1.9.0 → 1.70.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +455 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-sqs/client.rb +1148 -438
- data/lib/aws-sdk-sqs/client_api.rb +383 -45
- data/lib/aws-sdk-sqs/customizations.rb +2 -0
- data/lib/aws-sdk-sqs/endpoint_parameters.rb +66 -0
- data/lib/aws-sdk-sqs/endpoint_provider.rb +57 -0
- data/lib/aws-sdk-sqs/endpoints.rb +338 -0
- data/lib/aws-sdk-sqs/errors.rb +463 -1
- data/lib/aws-sdk-sqs/message.rb +20 -9
- data/lib/aws-sdk-sqs/plugins/endpoints.rb +116 -0
- data/lib/aws-sdk-sqs/plugins/md5s.rb +9 -7
- data/lib/aws-sdk-sqs/plugins/queue_urls.rb +26 -12
- data/lib/aws-sdk-sqs/queue.rb +269 -125
- data/lib/aws-sdk-sqs/queue_poller.rb +75 -37
- data/lib/aws-sdk-sqs/resource.rb +208 -79
- data/lib/aws-sdk-sqs/types.rb +1294 -539
- data/lib/aws-sdk-sqs.rb +16 -6
- data/sig/client.rbs +363 -0
- data/sig/errors.rbs +98 -0
- data/sig/message.rbs +73 -0
- data/sig/queue.rbs +163 -0
- data/sig/resource.rbs +105 -0
- data/sig/types.rbs +471 -0
- data/sig/waiters.rbs +13 -0
- metadata +29 -16
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'openssl'
|
2
4
|
|
3
5
|
module Aws
|
@@ -50,7 +52,9 @@ module Aws
|
|
50
52
|
|
51
53
|
def validate_single_message(body, attributes, response)
|
52
54
|
validate_body(body, response)
|
53
|
-
|
55
|
+
unless attributes.nil? || attributes.empty?
|
56
|
+
validate_attributes(attributes, response)
|
57
|
+
end
|
54
58
|
end
|
55
59
|
|
56
60
|
def validate_body(body, response)
|
@@ -117,14 +121,12 @@ module Aws
|
|
117
121
|
end
|
118
122
|
|
119
123
|
def mismatch_error_message(section, local_md5, returned_md5, response)
|
120
|
-
m =
|
121
|
-
|
122
|
-
|
124
|
+
m = 'MD5 returned by SQS does not match '\
|
125
|
+
'the calculation on the original request. ('
|
123
126
|
if response.respond_to?(:id) && !response.id.nil?
|
124
|
-
m
|
127
|
+
m = "#{m}Message ID: #{response.id}, "
|
125
128
|
end
|
126
|
-
|
127
|
-
m << "MD5 calculated by the #{section}: " <<
|
129
|
+
"#{m}MD5 calculated by the #{section}: "\
|
128
130
|
"'#{local_md5}', MD5 checksum returned: '#{returned_md5}')"
|
129
131
|
end
|
130
132
|
end
|
@@ -1,13 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Aws
|
2
4
|
module SQS
|
3
5
|
module Plugins
|
4
6
|
# @api private
|
5
7
|
class QueueUrls < Seahorse::Client::Plugin
|
6
|
-
|
8
|
+
# Extract region from a provided queue_url
|
7
9
|
class Handler < Seahorse::Client::Handler
|
8
|
-
|
9
10
|
def call(context)
|
10
|
-
if queue_url = context.params[:queue_url]
|
11
|
+
if (queue_url = context.params[:queue_url])
|
11
12
|
update_endpoint(context, queue_url)
|
12
13
|
update_region(context, queue_url)
|
13
14
|
end
|
@@ -19,18 +20,31 @@ module Aws
|
|
19
20
|
end
|
20
21
|
|
21
22
|
# If the region in the queue url is not the configured
|
22
|
-
# region, then we will modify
|
23
|
-
# a sigv4 signer for the proper region.
|
23
|
+
# region, then we will modify signing to use it
|
24
24
|
def update_region(context, queue_url)
|
25
|
-
if queue_region = queue_url
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
if (queue_region = parse_region(queue_url)) &&
|
26
|
+
queue_region != context.config.region
|
27
|
+
context[:auth_scheme]['signingRegion'] = queue_region
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
# take the first component after the SQS service component
|
34
|
+
# Will return us-east-1 for:
|
35
|
+
# https://sqs.us-east-1.amazonaws.com/1234567890/demo
|
36
|
+
# https://vpce-x-y.sqs.us-east-1.vpce.amazonaws.com/1234567890/demo
|
37
|
+
# Will not return for:
|
38
|
+
# https://localstack-sqs.example.dev/queue/example
|
39
|
+
def parse_region(url)
|
40
|
+
parts = URI.parse(url).host.split('.')
|
41
|
+
parts.each_with_index do |part, index|
|
42
|
+
if part == 'sqs'
|
43
|
+
# assume region is the part right after the 'sqs' part
|
44
|
+
return parts[index + 1]
|
32
45
|
end
|
33
46
|
end
|
47
|
+
nil # no region found
|
34
48
|
end
|
35
49
|
|
36
50
|
end
|