-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #424 from ericzbeard/macros
Macros
- Loading branch information
Showing
115 changed files
with
1,910 additions
and
33,766 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ignore_templates: | ||
- **/example.yaml | ||
ignore_checks: | ||
- W3002 # This is for having to deploy templates using aws cloudformation package | ||
- W3005 | ||
- I1022 # Prefer sub over join on empty delimiter | ||
- I3011 # Set explicit values for UpdateReplacePolicy / DeletionPolicy on potentially stateful resource | ||
include_checks: | ||
- I | ||
regions: | ||
- ALL_REGIONS |
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
28 changes: 28 additions & 0 deletions
28
aws/services/CloudFormation/MacrosExamples/Boto3/example.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,28 @@ | ||
{ | ||
"Transform": "Boto3", | ||
"Resources": { | ||
"Repo": { | ||
"Type": "AWS::CodeCommit::Repository", | ||
"Properties": { | ||
"RepositoryName": "my-repo" | ||
} | ||
}, | ||
"AddReadme": { | ||
"Type": "Boto3::CodeCommit.put_file", | ||
"Properties": { | ||
"RepositoryName": { | ||
"Fn::GetAtt": [ | ||
"Repo", | ||
"Name" | ||
] | ||
}, | ||
"BranchName": "master", | ||
"FileContent": "Hello, world", | ||
"FilePath": "README.md", | ||
"CommitMessage": "Add another README.md", | ||
"Name": "CloudFormation" | ||
}, | ||
"Mode": "Create" | ||
} | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
aws/services/CloudFormation/MacrosExamples/Boto3/lambda/custom_response.py
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,53 @@ | ||
""" | ||
Custom resource cfn-response module. | ||
""" | ||
|
||
from __future__ import print_function | ||
import json | ||
import urllib3 | ||
|
||
SUCCESS = "SUCCESS" | ||
FAILED = "FAILED" | ||
|
||
http = urllib3.PoolManager() | ||
|
||
#pylint: disable=too-many-arguments,too-many-locals | ||
def send(event, context, response_status, | ||
response_data, physical_resource_id=None, no_echo=False, reason=None): | ||
"Send a response to CloudFormation regarding the status of the custom resource." | ||
response_url = event['ResponseURL'] | ||
|
||
print(response_url) | ||
|
||
default_reason = "See the details in CloudWatch Log Stream: {}" | ||
|
||
response_body = { | ||
'Status' : response_status, | ||
'Reason' : reason or default_reason.format(context.log_stream_name), | ||
'PhysicalResourceId' : physical_resource_id or context.log_stream_name, | ||
'StackId' : event['StackId'], | ||
'RequestId' : event['RequestId'], | ||
'LogicalResourceId' : event['LogicalResourceId'], | ||
'NoEcho' : no_echo, | ||
'Data' : response_data | ||
} | ||
|
||
json_response_body = json.dumps(response_body) | ||
|
||
print("Response body:") | ||
print(json_response_body) | ||
|
||
headers = { | ||
'content-type' : '', | ||
'content-length' : str(len(json_response_body)) | ||
} | ||
|
||
try: | ||
response = http.request('PUT', response_url, | ||
headers=headers, body=json_response_body) | ||
print("Status code:", response.status) | ||
|
||
|
||
except Exception as e: | ||
print("send(..) failed executing http.request(..):", e) | ||
|
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
Oops, something went wrong.