-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Release/v1.37.0 (#2069) * chore: bump version to 1.37.0 (#2068) * fix: Increase PageSize of ListPolicies Paginator (#2033) Co-authored-by: Jacob Fuss <32497805+jfuss@users.noreply.github.com> Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com> * feat: Support VIRTUAL_HOST as Type for SourceAccessConfiguration for MQ events (#76) (#2078) Co-authored-by: Renato Valenzuela <37676028+valerena@users.noreply.github.com>
- Loading branch information
Showing
23 changed files
with
529 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.36.0" | ||
__version__ = "1.37.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from unittest import TestCase | ||
from samtranslator.model.eventsources.pull import MQ | ||
|
||
|
||
class MQEventSource(TestCase): | ||
def setUp(self): | ||
self.logical_id = "MQEvent" | ||
self.mq_event_source = MQ(self.logical_id) | ||
|
||
def test_get_policy_arn(self): | ||
source_arn = self.mq_event_source.get_policy_arn() | ||
expected_source_arn = None | ||
self.assertEqual(source_arn, expected_source_arn) | ||
|
||
def test_get_policy_statements(self): | ||
self.mq_event_source.SourceAccessConfigurations = [{"Type": "BASIC_AUTH", "URI": "SECRET_URI"}] | ||
self.mq_event_source.Broker = "BROKER_ARN" | ||
policy_statements = self.mq_event_source.get_policy_statements() | ||
expected_policy_document = [ | ||
{ | ||
"PolicyName": "SamAutoGeneratedAMQPolicy", | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"secretsmanager:GetSecretValue", | ||
], | ||
"Effect": "Allow", | ||
"Resource": "SECRET_URI", | ||
}, | ||
{ | ||
"Action": [ | ||
"mq:DescribeBroker", | ||
], | ||
"Effect": "Allow", | ||
"Resource": "BROKER_ARN", | ||
}, | ||
] | ||
}, | ||
} | ||
] | ||
self.assertEqual(policy_statements, expected_policy_document) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Resources: | ||
MQFunction: | ||
Type: 'AWS::Serverless::Function' | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/queues.zip | ||
Handler: queue.mq_handler | ||
Runtime: python2.7 | ||
Events: | ||
MyMQQueue: | ||
Type: MQ | ||
Properties: | ||
Broker: arn:aws:mq:us-east-2:123456789012:broker:MyBroker:b-1234a5b6-78cd-901e-2fgh-3i45j6k178l9 | ||
Queues: | ||
- "Queue1" | ||
SourceAccessConfigurations: | ||
- Type: BASIC_AUTH | ||
URI: arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c | ||
- Type: VPC_SUBNET | ||
URI: invalidforMQtriggers |
17 changes: 17 additions & 0 deletions
17
tests/translator/input/error_missing_basic_auth_in_mq.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Resources: | ||
MQFunction: | ||
Type: 'AWS::Serverless::Function' | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/queues.zip | ||
Handler: queue.mq_handler | ||
Runtime: python2.7 | ||
Events: | ||
MyMQQueue: | ||
Type: MQ | ||
Properties: | ||
Broker: arn:aws:mq:us-east-2:123456789012:broker:MyBroker:b-1234a5b6-78cd-901e-2fgh-3i45j6k178l9 | ||
Queues: | ||
- "Queue1" | ||
SourceAccessConfigurations: | ||
- Type: VIRTUAL_HOST | ||
URI: vhost_name |
16 changes: 16 additions & 0 deletions
16
tests/translator/input/error_missing_basic_auth_uri_in_mq.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Resources: | ||
MQFunction: | ||
Type: 'AWS::Serverless::Function' | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/queues.zip | ||
Handler: queue.mq_handler | ||
Runtime: python2.7 | ||
Events: | ||
MyMQQueue: | ||
Type: MQ | ||
Properties: | ||
Broker: arn:aws:mq:us-east-2:123456789012:broker:MyBroker:b-1234a5b6-78cd-901e-2fgh-3i45j6k178l9 | ||
Queues: | ||
- "Queue1" | ||
SourceAccessConfigurations: | ||
- Type: BASIC_AUTH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Resources: | ||
MQFunction: | ||
Type: 'AWS::Serverless::Function' | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/queues.zip | ||
Handler: queue.mq_handler | ||
Runtime: python2.7 | ||
Events: | ||
MyMQQueue: | ||
Type: MQ | ||
Properties: | ||
Broker: arn:aws:mq:us-east-2:123456789012:broker:MyBroker:b-1234a5b6-78cd-901e-2fgh-3i45j6k178l9 | ||
Queues: | ||
- "Queue1" | ||
SourceAccessConfigurations: [] |
19 changes: 19 additions & 0 deletions
19
tests/translator/input/error_multiple_basic_auth_in_mq.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Resources: | ||
MQFunction: | ||
Type: 'AWS::Serverless::Function' | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/queues.zip | ||
Handler: queue.mq_handler | ||
Runtime: python2.7 | ||
Events: | ||
MyMQQueue: | ||
Type: MQ | ||
Properties: | ||
Broker: arn:aws:mq:us-east-2:123456789012:broker:MyBroker:b-1234a5b6-78cd-901e-2fgh-3i45j6k178l9 | ||
Queues: | ||
- "Queue1" | ||
SourceAccessConfigurations: | ||
- Type: BASIC_AUTH | ||
URI: arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c | ||
- Type: BASIC_AUTH | ||
URI: arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-second-secret-1a2b3c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Resources: | ||
MQFunction: | ||
Type: 'AWS::Serverless::Function' | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/queues.zip | ||
Handler: queue.mq_handler | ||
Runtime: python2.7 | ||
Events: | ||
MyMQQueue: | ||
Type: MQ | ||
Properties: | ||
Broker: arn:aws:mq:us-east-2:123456789012:broker:MyBroker:b-1234a5b6-78cd-901e-2fgh-3i45j6k178l9 | ||
Queues: | ||
- "Queue1" | ||
SourceAccessConfigurations: | ||
- Type: BASIC_AUTH | ||
URI: arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c | ||
- Type: VIRTUAL_HOST | ||
URI: vhost_name |
102 changes: 102 additions & 0 deletions
102
tests/translator/output/aws-cn/function_with_mq_virtual_host.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"Resources": { | ||
"MQFunction": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties": { | ||
"Code": { | ||
"S3Bucket": "sam-demo-bucket", | ||
"S3Key": "queues.zip" | ||
}, | ||
"Handler": "queue.mq_handler", | ||
"Role": { | ||
"Fn::GetAtt": [ | ||
"MQFunctionRole", | ||
"Arn" | ||
] | ||
}, | ||
"Runtime": "python2.7", | ||
"Tags": [ | ||
{ | ||
"Key": "lambda:createdBy", | ||
"Value": "SAM" | ||
} | ||
] | ||
} | ||
}, | ||
"MQFunctionRole": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"sts:AssumeRole" | ||
], | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": [ | ||
"lambda.amazonaws.com" | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
"ManagedPolicyArns": [ | ||
"arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
], | ||
"Policies": [ | ||
{ | ||
"PolicyName": "SamAutoGeneratedAMQPolicy", | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"secretsmanager:GetSecretValue" | ||
], | ||
"Effect": "Allow", | ||
"Resource": "arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c" | ||
}, | ||
{ | ||
"Action": [ | ||
"mq:DescribeBroker" | ||
], | ||
"Effect": "Allow", | ||
"Resource": "arn:aws:mq:us-east-2:123456789012:broker:MyBroker:b-1234a5b6-78cd-901e-2fgh-3i45j6k178l9" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"Tags": [ | ||
{ | ||
"Key": "lambda:createdBy", | ||
"Value": "SAM" | ||
} | ||
] | ||
} | ||
}, | ||
"MQFunctionMyMQQueue": { | ||
"Type": "AWS::Lambda::EventSourceMapping", | ||
"Properties": { | ||
"EventSourceArn": "arn:aws:mq:us-east-2:123456789012:broker:MyBroker:b-1234a5b6-78cd-901e-2fgh-3i45j6k178l9", | ||
"FunctionName": { | ||
"Ref": "MQFunction" | ||
}, | ||
"Queues": [ | ||
"Queue1" | ||
], | ||
"SourceAccessConfigurations": [ | ||
{ | ||
"Type": "BASIC_AUTH", | ||
"URI": "arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c" | ||
}, | ||
{ | ||
"Type": "VIRTUAL_HOST", | ||
"URI": "vhost_name" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.