SNSAccess

SNS Access

class awsimple.sns.SNSAccess(topic_name: str, auto_create: bool = False, **kwargs)

Bases: AWSAccess

SNS Access

Parameters:
  • topic_name – SNS topic

  • kwargs – kwargs

create_topic() → str

create an SNS topic

Returns:

the SNS topic’s arn

delete_topic()

delete SNS topic

get_arn() → str

get topic ARN from topic name

Returns:

topic ARN

get_topic() → Any

gets the associated SNS Topic instance (cached per instance)

Returns:

sns.Topic instance

publish(message: str, subject: str | None = None, attributes: dict | None = None) → str

publish to an existing SNS topic

Parameters:
  • message – message string

  • subject – subject string

  • attributes – message attributes (see AWS SNS documentation on SNS MessageAttributes)

Returns:

message ID

subscribe(subscriber: str | SQSAccess) → str

Subscribe to an SNS topic

Parameters:

subscriber – email

Returns:

subscription ARN