Allow attributes to be set with subscribe command (#1705)

This commit is contained in:
Michael Bell 2018-07-13 19:21:33 +10:00 committed by Terry Cain
commit 51db19067c
2 changed files with 71 additions and 0 deletions

View file

@ -181,6 +181,7 @@ class SNSResponse(BaseResponse):
topic_arn = self._get_param('TopicArn')
endpoint = self._get_param('Endpoint')
protocol = self._get_param('Protocol')
attributes = self._get_attributes()
if protocol == 'sms' and not is_e164(endpoint):
return self._error(
@ -190,6 +191,10 @@ class SNSResponse(BaseResponse):
subscription = self.backend.subscribe(topic_arn, endpoint, protocol)
if attributes is not None:
for attr_name, attr_value in attributes.items():
self.backend.set_subscription_attributes(subscription.arn, attr_name, attr_value)
if self.request_json:
return json.dumps({
"SubscribeResponse": {