-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 #1374 from awslabs/develop
v0.21.0
- Loading branch information
Showing
123 changed files
with
10,391 additions
and
19 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
SAM CLI version | ||
""" | ||
|
||
__version__ = '0.20.0' | ||
__version__ = '0.21.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
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
33 changes: 33 additions & 0 deletions
33
...li/commands/local/lib/generated_sample_events/events/connect/ConnectContactFlowEvent.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,33 @@ | ||
{ | ||
"Name": "ContactFlowEvent", | ||
"Details": { | ||
"ContactData": { | ||
"Attributes": {}, | ||
"Channel": "VOICE", | ||
"ContactId": "{{{contact_id}}}", | ||
"CustomerEndpoint": { | ||
"Address": "{{{phone_number}}}", | ||
"Type": "TELEPHONE_NUMBER" | ||
}, | ||
"InitialContactId": "{{{contact_id}}}", | ||
"InitiationMethod": "API", | ||
"InstanceARN": "arn:{{{partition}}}:connect:{{{region}}}:{{{account_id}}}:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa", | ||
"MediaStreams": { | ||
"Customer": { | ||
"Audio": { | ||
"StartFragmentNumber": "91343852333181432392682062622220590765191907586", | ||
"StartTimestamp": "1565781909613", | ||
"StreamARN": "arn:{{{partition}}}:kinesisvideo:{{{region}}}:{{{account_id}}}:stream/connect-contact-a3d73b84-ce0e-479a-a9dc-5637c9d30ac9/1565272947806" | ||
} | ||
} | ||
}, | ||
"PreviousContactId": "{{{contact_id}}}", | ||
"Queue": null, | ||
"SystemEndpoint": { | ||
"Address": "{{{phone_number}}}", | ||
"Type": "TELEPHONE_NUMBER" | ||
} | ||
}, | ||
"Parameters": {} | ||
} | ||
} |
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
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
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
Binary file not shown.
Empty file.
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,61 @@ | ||
import requests | ||
import os | ||
import logging | ||
import time | ||
import boto3 | ||
|
||
|
||
logging.basicConfig(level=logging.INFO) | ||
LOG = logging.getLogger() | ||
TEMPLATE_FOLDER = os.path.join("templates", "sar") | ||
|
||
|
||
def download(count=100): | ||
|
||
sar_browse_url = "https://shr32taah3.execute-api.us-east-1.amazonaws.com/Prod/applications/browse" | ||
current_page = 1 | ||
retry_count = 0 | ||
apps = [] | ||
|
||
while len(apps) < count and retry_count < 10: | ||
try: | ||
response = requests.get(sar_browse_url, { | ||
"pageSize": count if count < 10 else 10, | ||
"pageNumber": current_page, | ||
"includeAppsWithCapabilities": "CAPABILITY_IAM,CAPABILITY_NAMED_IAM,CAPABILITY_RESOURCE_POLICY,CAPABILITY_AUTO_EXPAND" | ||
}) | ||
|
||
response.raise_for_status() | ||
result = response.json() | ||
|
||
# Successful request | ||
apps = apps + result["applications"] | ||
current_page += 1 | ||
retry_count = 0 | ||
except requests.exceptions.RequestException as ex: | ||
LOG.warning("Got throttled by SAR", exc_info=ex) | ||
retry_count += 1 | ||
|
||
for index, app in enumerate(apps): | ||
app_id = app["id"] | ||
name = app["name"] | ||
template_file_name = os.path.join(TEMPLATE_FOLDER, name+"-template.yaml") | ||
LOG.info("[%s/%s] %s", index, count, name) | ||
_download_templates(app_id, template_file_name) | ||
time.sleep(0.1) # 100ms aka 10 TPS | ||
|
||
def _download_templates(app_id, template_file_path): | ||
sar = boto3.client('serverlessrepo') | ||
response = sar.get_application(ApplicationId=app_id) | ||
|
||
template_url = response["Version"]["TemplateUrl"] | ||
|
||
with open(template_file_path, "wb") as fp: | ||
r = requests.get(template_url, stream=True) | ||
for chunk in r.iter_content(chunk_size=128): | ||
fp.write(chunk) | ||
|
||
if __name__ == "__main__": | ||
count = 100 | ||
LOG.info("Downloading %s templates", count) | ||
download(count=count) |
Oops, something went wrong.