Creates a notification topic. :param name: The name of the topic to create. :return: The newly created topic.
(self, name)
| 32 | |
| 33 | # snippet-start:[python.example_code.sns.CreateTopic] |
| 34 | def create_topic(self, name): |
| 35 | """ |
| 36 | Creates a notification topic. |
| 37 | |
| 38 | :param name: The name of the topic to create. |
| 39 | :return: The newly created topic. |
| 40 | """ |
| 41 | try: |
| 42 | topic = self.sns_resource.create_topic(Name=name) |
| 43 | logger.info("Created topic %s with ARN %s.", name, topic.arn) |
| 44 | except ClientError: |
| 45 | logger.exception("Couldn't create topic %s.", name) |
| 46 | raise |
| 47 | else: |
| 48 | return topic |
| 49 | |
| 50 | # snippet-end:[python.example_code.sns.CreateTopic] |
| 51 |
no outgoing calls