conrad 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/conrad/emitters/sqs.rb +12 -9
- data/lib/conrad/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b41619922ba6057aff0e0c1132b13ebd674e897f6edd141a7f4fc2ce6c8fad70
|
4
|
+
data.tar.gz: 381de5251326c319d50f1c4d6d2af93a1b00ffca594f5b3e423647c105cfb75a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1d65e6a2141b159ee97077ecaa4cb9917edc060b5611736a17146e7f37daea7ce88984380d89ad6ddba30ef55ba3d1c7c81be717506bb1eafa1029e7c176f1a
|
7
|
+
data.tar.gz: 1455dbf8b1ac7b2a39c78c61fd000508d2cb222fa75c13aac7105f4a296a9667ccf2bc102bd9692583da303dacd8cee2aad03b28d4f68b431f503acb01bcf5e8
|
data/lib/conrad/emitters/sqs.rb
CHANGED
@@ -13,7 +13,7 @@ module Conrad
|
|
13
13
|
class InvalidAwsCredentials < ::Conrad::Error
|
14
14
|
# :nodoc:
|
15
15
|
def to_s
|
16
|
-
'Must provide secret_access_key
|
16
|
+
'Must provide secret_access_key and access_key_id OR rely ' \
|
17
17
|
'on configured values in the running environment.'
|
18
18
|
end
|
19
19
|
end
|
@@ -21,7 +21,6 @@ module Conrad
|
|
21
21
|
# @return [String] the configured SQS queue URL
|
22
22
|
attr_reader :queue_url
|
23
23
|
|
24
|
-
# @deprecated Will be removed in 3.0.0, no migration path
|
25
24
|
# @return [String, nil] the configured region
|
26
25
|
attr_reader :region
|
27
26
|
|
@@ -41,9 +40,11 @@ module Conrad
|
|
41
40
|
# @param access_key_id [String] AWS Acesss Key ID
|
42
41
|
# @param secret_access_key [String] AWS Secret Access Key
|
43
42
|
#
|
44
|
-
# @raise [InvalidAwsCredentials] if
|
45
|
-
#
|
46
|
-
#
|
43
|
+
# @raise [InvalidAwsCredentials] if access_key_id or secret_access_key are
|
44
|
+
# not provided AND the running environment does not have valid AWS
|
45
|
+
# credentials
|
46
|
+
# @raise [Aws::Errors::MissingRegionError] if region is not provided and
|
47
|
+
# also not set via an allowed AWS environment variable
|
47
48
|
def initialize(queue_url:, region: nil, access_key_id: nil, secret_access_key: nil)
|
48
49
|
@queue_url = queue_url
|
49
50
|
@region = region
|
@@ -54,6 +55,8 @@ module Conrad
|
|
54
55
|
end
|
55
56
|
|
56
57
|
# Sends an event up to SQS
|
58
|
+
#
|
59
|
+
# @param event [String] the event to be sent as an SQS message body
|
57
60
|
def call(event)
|
58
61
|
client.send_message(queue_url: queue_url, message_body: event)
|
59
62
|
end
|
@@ -61,16 +64,16 @@ module Conrad
|
|
61
64
|
private
|
62
65
|
|
63
66
|
def create_client(region:, access_key_id:, secret_access_key:)
|
64
|
-
if secret_access_key.nil? || access_key_id.nil?
|
67
|
+
if secret_access_key.nil? || access_key_id.nil?
|
65
68
|
validate_implicit_credentials
|
66
69
|
|
67
|
-
@client = Aws::SQS::Client.new
|
70
|
+
@client = Aws::SQS::Client.new({ region: region }.compact)
|
68
71
|
else
|
69
|
-
@client = Aws::SQS::Client.new(
|
72
|
+
@client = Aws::SQS::Client.new({
|
70
73
|
region: region,
|
71
74
|
access_key_id: access_key_id,
|
72
75
|
secret_access_key: secret_access_key
|
73
|
-
)
|
76
|
+
}.compact)
|
74
77
|
end
|
75
78
|
end
|
76
79
|
|
data/lib/conrad/version.rb
CHANGED