Skip to content

Commit 48eb41d

Browse files
authored
Merge pull request #2870 from aws/release-v1.59.0
Release 1.59.0 (to main)
2 parents 3a2da9e + 6094eeb commit 48eb41d

File tree

163 files changed

+337926
-5818
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+337926
-5818
lines changed

.coveragerc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ omit =
55
samtranslator/schema/*
66
[report]
77
exclude_lines =
8-
pragma: no cover
9-
raise NotImplementedError.*
8+
pragma: no cover

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,4 @@ venv.bak/
119119
# Companion stack config
120120
integration/config/file_to_s3_map_modified.json
121121

122-
.tmp_schema.json
122+
.tmp

.pylintrc

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,19 @@ disable=
7676
R0401, # Cyclic import
7777
C0411, # import ordering
7878
W9015, # missing parameter in doc strings
79-
R0205, # useless-object-inheritanc
8079
C0301, # line to long
8180
C0114, # missing-module-docstring
8281
W1202, # Use lazy % formatting in logging functions (logging-format-interpolation)
83-
E1101, # No member
84-
W0622, # Redefining built-in 'property' (redefined-builtin)
82+
E1101, # No member
8583
W0212, # protected-access
8684
W0201, # attribute-defined-outside-init
87-
R1725, # Consider using Python 3 style super() without arguments (super-with-arguments)
8885
C2001, # Avoid comparisons to zero (compare-to-zero)
8986
R0912, # too many branches
90-
W0235, # Useless super delegation in method '__init__' (useless-super-delegation)
9187
C0412, # Imports from package samtranslator are not grouped (ungrouped-imports)
92-
W0223, # abstract-method
93-
W0107, # unnecessary-pass
94-
W0707, # raise-missing-from
9588
E0203, # access-member-before-definition
9689
W0221, # arguments-differ
97-
R1710, # inconsistent-return-statements
9890
R1702, # too-many-nested-blocks
99-
C0123, # Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
10091
W0105, # String statement has no effect (pointless-string-statement)
101-
C0206, # Consider iterating with .items() (consider-using-dict-items)
102-
W9008, # Redundant returns documentation (redundant-returns-doc)
10392
C0112, # empty-docstring
10493
C0116, # missing-function-docstring
10594
W9017, # differing-param-doc

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ include samtranslator/policy_templates_data/schema.json
77
include samtranslator/model/connector_profiles/profiles.json
88
include samtranslator/schema/docs.json
99
include samtranslator/schema/schema.json
10+
include samtranslator/schema/sam.schema.json
11+
include samtranslator/schema/cloudformation.schema.json
1012
include README.md
1113
include THIRD_PARTY_LICENSES
1214

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ black:
2525

2626
black-check:
2727
# Checking latest schema was generated (run `make schema` if this fails)
28-
python samtranslator/schema/schema.py > .tmp_schema.json
29-
diff -u samtranslator/schema/schema.json .tmp_schema.json
30-
rm .tmp_schema.json
28+
mkdir -p .tmp
29+
python samtranslator/schema/schema.py --sam-schema .tmp/sam.schema.json --cfn-schema samtranslator/schema/cloudformation.schema.json --unified-schema .tmp/schema.json
30+
diff -u samtranslator/schema/sam.schema.json .tmp/sam.schema.json
31+
diff -u samtranslator/schema/schema.json .tmp/schema.json
3132
black --check setup.py samtranslator/* tests/* integration/* bin/*.py
3233
bin/json-format.py --check tests integration samtranslator/policy_templates_data
3334
bin/yaml-format.py --check tests
@@ -44,15 +45,21 @@ lint:
4445
prepare-companion-stack:
4546
pytest -v --no-cov integration/setup -m setup
4647

48+
update-cfn-schema:
49+
curl -o samtranslator/schema/cloudformation.schema.json https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json
50+
4751
schema:
48-
python samtranslator/schema/schema.py > samtranslator/schema/schema.json
52+
python samtranslator/schema/schema.py --sam-schema samtranslator/schema/sam.schema.json --cfn-schema samtranslator/schema/cloudformation.schema.json --unified-schema samtranslator/schema/schema.json
4953

5054
# Command to run everytime you make changes to verify everything works
5155
dev: test
5256

5357
# Verifications to run before sending a pull request
5458
pr: black-check lint init dev
5559

60+
clean:
61+
rm -r .tmp
62+
5663
define HELP_MESSAGE
5764

5865
Usage: $ make [TARGETS]

bin/run_cfn_lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ VENV=.venv_cfn_lint
77
# See https://github.com/aws/serverless-application-model/issues/1042
88
if [ ! -d "${VENV}" ]; then
99
python3 -m venv "${VENV}"
10-
"${VENV}/bin/python" -m pip install cfn-lint==0.72.2 --quiet
10+
"${VENV}/bin/python" -m pip install cfn-lint --quiet
1111
fi
1212

1313
"${VENV}/bin/cfn-lint" --format parseable

integration/combination/test_connectors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def tearDown(self):
4747
("combination/connector_sqs_to_function",),
4848
("combination/connector_sns_to_function_write",),
4949
("combination/connector_table_to_function_read",),
50+
("combination/embedded_connector",),
5051
]
5152
)
5253
@retry_once
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
{
3+
"LogicalResourceId": "MyRole1",
4+
"ResourceType": "AWS::IAM::Role"
5+
},
6+
{
7+
"LogicalResourceId": "MyRole2",
8+
"ResourceType": "AWS::IAM::Role"
9+
},
10+
{
11+
"LogicalResourceId": "TriggerFunction",
12+
"ResourceType": "AWS::Lambda::Function"
13+
},
14+
{
15+
"LogicalResourceId": "MyFunction2",
16+
"ResourceType": "AWS::Lambda::Function"
17+
},
18+
{
19+
"LogicalResourceId": "TriggerFunctionMyConnectorPolicy",
20+
"ResourceType": "AWS::IAM::ManagedPolicy"
21+
}
22+
]

integration/resources/templates/combination/api_with_authorizer_apikey.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Outputs:
104104
ApiKeyId:
105105
Description: API Key ID
106106
Value:
107-
Fn::GetAtt: MyFirstApiKey.APIKeyId
107+
Ref: MyFirstApiKey
108108
ApiUrl:
109109
Description: API endpoint URL for Prod environment
110110
Value:
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Resources:
2+
MyRole1:
3+
Type: AWS::IAM::Role
4+
Properties:
5+
AssumeRolePolicyDocument:
6+
Statement:
7+
- Effect: Allow
8+
Action: sts:AssumeRole
9+
Principal:
10+
Service: lambda.amazonaws.com
11+
ManagedPolicyArns:
12+
- !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
13+
14+
MyRole2:
15+
Type: AWS::IAM::Role
16+
Properties:
17+
AssumeRolePolicyDocument:
18+
Statement:
19+
- Effect: Allow
20+
Action: sts:AssumeRole
21+
Principal:
22+
Service: lambda.amazonaws.com
23+
ManagedPolicyArns:
24+
- !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
25+
26+
TriggerFunction:
27+
Type: AWS::Lambda::Function
28+
Connectors:
29+
MyConnector:
30+
Properties:
31+
Destination:
32+
Id: MyFunction2
33+
Permissions:
34+
- Write
35+
Properties:
36+
Role: !GetAtt MyRole1.Arn
37+
Runtime: nodejs14.x
38+
Handler: index.handler
39+
Code:
40+
ZipFile: |
41+
const AWS = require('aws-sdk');
42+
exports.handler = async (event) => {
43+
const params = {
44+
FunctionName: process.env.FUNCTION_NAME,
45+
InvocationType: 'RequestResponse',
46+
Payload: '{}',
47+
};
48+
const lambda = new AWS.Lambda();
49+
const response = await lambda.invoke(params).promise();
50+
if(response.StatusCode !== 200){
51+
throw new Error('Failed to get response from lambda function')
52+
}
53+
return response;
54+
};
55+
Environment:
56+
Variables:
57+
FUNCTION_NAME: !Ref MyFunction2
58+
59+
MyFunction2:
60+
Type: AWS::Lambda::Function
61+
Properties:
62+
Role: !GetAtt MyRole2.Arn
63+
Runtime: nodejs14.x
64+
Handler: index.handler
65+
Code:
66+
ZipFile: |
67+
const AWS = require('aws-sdk');
68+
exports.handler = async (event) => {
69+
console.log(JSON.stringify(event));
70+
};
71+
Metadata:
72+
SamTransformTest: true

0 commit comments

Comments
 (0)