Makes Creating SNS topics idempotent (#1324)
Make creating SNS topics idempotent Closes #1323
This commit is contained in:
parent
70e7f08d8f
commit
d0a285536d
2 changed files with 29 additions and 3 deletions
|
|
@ -193,9 +193,12 @@ class SNSBackend(BaseBackend):
|
|||
self.sms_attributes.update(attrs)
|
||||
|
||||
def create_topic(self, name):
|
||||
topic = Topic(name, self)
|
||||
self.topics[topic.arn] = topic
|
||||
return topic
|
||||
candidate_topic = Topic(name, self)
|
||||
if candidate_topic.arn in self.topics:
|
||||
return self.topics[candidate_topic.arn]
|
||||
else:
|
||||
self.topics[candidate_topic.arn] = candidate_topic
|
||||
return candidate_topic
|
||||
|
||||
def _get_values_nexttoken(self, values_map, next_token=None):
|
||||
if next_token is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue