Skip to content

SNSServiceResource#

Index > SNS > SNSServiceResource

Auto-generated documentation for SNS type annotations stubs module types-boto3-sns.

SNSServiceResource#

Type annotations and code completion for boto3.resource("sns"), included resources and collections. boto3 documentation

# SNSServiceResource usage example

from types_boto3_sns.service_resource import SNSServiceResource

def get_sns_resource() -> SNSServiceResource:
    return boto3.resource("sns")

Attributes#

  • meta: SNSResourceMeta

  • platform_applications: ServiceResourcePlatformApplicationsCollection

  • subscriptions: ServiceResourceSubscriptionsCollection

  • topics: ServiceResourceTopicsCollection

Collections#

ServiceResourcePlatformApplicationsCollection#

Provides access to PlatformApplication resource.

Type annotations and code completion for boto3.resource("sns").platform_applications collection. boto3 documentation

# ServiceResourcePlatformApplicationsCollection usage example

from types_boto3_sns.service_resource import ServiceResourcePlatformApplicationsCollection

def get_collection() -> ServiceResourcePlatformApplicationsCollection:
    return boto3.resource("sns").platform_applications

ServiceResourceSubscriptionsCollection#

Provides access to Subscription resource.

Type annotations and code completion for boto3.resource("sns").subscriptions collection. boto3 documentation

# ServiceResourceSubscriptionsCollection usage example

from types_boto3_sns.service_resource import ServiceResourceSubscriptionsCollection

def get_collection() -> ServiceResourceSubscriptionsCollection:
    return boto3.resource("sns").subscriptions

ServiceResourceTopicsCollection#

Provides access to Topic resource.

Type annotations and code completion for boto3.resource("sns").topics collection. boto3 documentation

# ServiceResourceTopicsCollection usage example

from types_boto3_sns.service_resource import ServiceResourceTopicsCollection

def get_collection() -> ServiceResourceTopicsCollection:
    return boto3.resource("sns").topics

Methods#

SNSServiceResource.get_available_subresources method#

Returns a list of all the available sub-resources for this resource.

Type annotations and code completion for boto3.resource("sns").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

SNSServiceResource.create_platform_application method#

Creates a platform application object for one of the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging), to which devices and mobile apps may register.

Type annotations and code completion for boto3.resource("sns").create_platform_application method. boto3 documentation

# create_platform_application method definition

def create_platform_application(
    self,
    *,
    Name: str,
    Platform: str,
    Attributes: Mapping[str, str],
) -> _PlatformApplication:
    ...
# create_platform_application method usage example with argument unpacking

kwargs: CreatePlatformApplicationInputServiceResourceCreatePlatformApplicationTypeDef = {  # (1)
    "Name": ...,
    "Platform": ...,
    "Attributes": ...,
}

parent.create_platform_application(**kwargs)
  1. See CreatePlatformApplicationInputServiceResourceCreatePlatformApplicationTypeDef

SNSServiceResource.create_topic method#

Creates a topic to which notifications can be published.

Type annotations and code completion for boto3.resource("sns").create_topic method. boto3 documentation

# create_topic method definition

def create_topic(
    self,
    *,
    Name: str,
    Attributes: Mapping[str, str] = ...,
    Tags: Sequence[TagTypeDef] = ...,  # (1)
    DataProtectionPolicy: str = ...,
) -> _Topic:
    ...
  1. See TagTypeDef
# create_topic method usage example with argument unpacking

kwargs: CreateTopicInputServiceResourceCreateTopicTypeDef = {  # (1)
    "Name": ...,
}

parent.create_topic(**kwargs)
  1. See CreateTopicInputServiceResourceCreateTopicTypeDef

SNSServiceResource.PlatformApplication method#

Creates a PlatformApplication resource.

Type annotations and code completion for boto3.resource("sns").PlatformApplication method. boto3 documentation

# PlatformApplication method definition

def PlatformApplication(
    self,
    arn: str,
) -> _PlatformApplication:
    ...

SNSServiceResource.PlatformEndpoint method#

Creates a PlatformEndpoint resource.

Type annotations and code completion for boto3.resource("sns").PlatformEndpoint method. boto3 documentation

# PlatformEndpoint method definition

def PlatformEndpoint(
    self,
    arn: str,
) -> _PlatformEndpoint:
    ...

SNSServiceResource.Subscription method#

Creates a Subscription resource.

Type annotations and code completion for boto3.resource("sns").Subscription method. boto3 documentation

# Subscription method definition

def Subscription(
    self,
    arn: str,
) -> _Subscription:
    ...

SNSServiceResource.Topic method#

Creates a Topic resource.

Type annotations and code completion for boto3.resource("sns").Topic method. boto3 documentation

# Topic method definition

def Topic(
    self,
    arn: str,
) -> _Topic:
    ...

PlatformApplication#

Type annotations and code completion for boto3.resource("sns").PlatformApplication class. boto3 documentation

# PlatformApplication usage example

from types_boto3_sns.service_resource import PlatformApplication

def get_resource() -> PlatformApplication:
    return boto3.resource("sns").PlatformApplication(...)

PlatformApplication attributes#

  • arn: str
  • endpoints: PlatformApplicationEndpointsCollection
  • attributes: dict[str, str]
  • meta: SNSResourceMeta

PlatformApplication collections#

PlatformApplication.endpoints#

Provides access to PlatformEndpoint resource.

Type annotations and code completion for boto3.resource("sns").PlatformApplication(...).endpoints collection. boto3 documentation

# PlatformApplicationEndpointsCollection usage example

from types_boto3_sns.service_resource import PlatformApplicationEndpointsCollection

def get_collection() -> PlatformApplicationEndpointsCollection:
    resource = boto3.resource("sns").PlatformApplication(...)
    return resource.endpoints

PlatformApplication methods#

PlatformApplication.get_available_subresources method#

Returns a list of all the available sub-resources for this PlatformApplication.

Type annotations and code completion for boto3.resource("sns").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

PlatformApplication.create_platform_endpoint method#

Creates an endpoint for a device and mobile app on one of the supported push notification services, such as GCM (Firebase Cloud Messaging) and APNS.

Type annotations and code completion for boto3.resource("sns").create_platform_endpoint method. boto3 documentation

# create_platform_endpoint method definition

def create_platform_endpoint(
    self,
    *,
    Token: str,
    CustomUserData: str = ...,
    Attributes: Mapping[str, str] = ...,
) -> _PlatformEndpoint:
    ...
# create_platform_endpoint method usage example with argument unpacking

kwargs: CreatePlatformEndpointInputPlatformApplicationCreatePlatformEndpointTypeDef = {  # (1)
    "Token": ...,
}

parent.create_platform_endpoint(**kwargs)
  1. See CreatePlatformEndpointInputPlatformApplicationCreatePlatformEndpointTypeDef

PlatformApplication.delete method#

Deletes a platform application object for one of the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging).

Type annotations and code completion for boto3.resource("sns").delete method. boto3 documentation

# delete method definition

def delete(
    self,
) -> None:
    ...

PlatformApplication.set_attributes method#

Sets the attributes of the platform application object for the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging).

Type annotations and code completion for boto3.resource("sns").set_attributes method. boto3 documentation

# set_attributes method definition

def set_attributes(
    self,
    *,
    Attributes: Mapping[str, str],
) -> None:
    ...
# set_attributes method usage example with argument unpacking

kwargs: SetPlatformApplicationAttributesInputPlatformApplicationSetAttributesTypeDef = {  # (1)
    "Attributes": ...,
}

parent.set_attributes(**kwargs)
  1. See SetPlatformApplicationAttributesInputPlatformApplicationSetAttributesTypeDef

PlatformApplication.load method#

Type annotations and code completion for boto3.resource("sns").load method. boto3 documentation

# load method definition

def load(
    self,
) -> None:
    ...

PlatformApplication.reload method#

Type annotations and code completion for boto3.resource("sns").reload method. boto3 documentation

# reload method definition

def reload(
    self,
) -> None:
    ...

PlatformEndpoint#

Type annotations and code completion for boto3.resource("sns").PlatformEndpoint class. boto3 documentation

# PlatformEndpoint usage example

from types_boto3_sns.service_resource import PlatformEndpoint

def get_resource() -> PlatformEndpoint:
    return boto3.resource("sns").PlatformEndpoint(...)

PlatformEndpoint attributes#

  • arn: str
  • attributes: dict[str, str]
  • meta: SNSResourceMeta

PlatformEndpoint methods#

PlatformEndpoint.get_available_subresources method#

Returns a list of all the available sub-resources for this PlatformEndpoint.

Type annotations and code completion for boto3.resource("sns").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

PlatformEndpoint.delete method#

Deletes the endpoint for a device and mobile app from Amazon SNS.

Type annotations and code completion for boto3.resource("sns").delete method. boto3 documentation

# delete method definition

def delete(
    self,
) -> None:
    ...

PlatformEndpoint.publish method#

Sends a message to an Amazon SNS topic, a text message (SMS message) directly to a phone number, or a message to a mobile platform endpoint (when you specify the TargetArn).

Type annotations and code completion for boto3.resource("sns").publish method. boto3 documentation

# publish method definition

def publish(
    self,
    *,
    Message: str,
    TopicArn: str = ...,
    PhoneNumber: str = ...,
    Subject: str = ...,
    MessageStructure: str = ...,
    MessageAttributes: Mapping[str, MessageAttributeValueTypeDef] = ...,  # (1)
    MessageDeduplicationId: str = ...,
    MessageGroupId: str = ...,
) -> PublishResponseTypeDef:  # (2)
    ...
  1. See MessageAttributeValueTypeDef
  2. See PublishResponseTypeDef
# publish method usage example with argument unpacking

kwargs: PublishInputPlatformEndpointPublishTypeDef = {  # (1)
    "Message": ...,
}

parent.publish(**kwargs)
  1. See PublishInputPlatformEndpointPublishTypeDef

PlatformEndpoint.set_attributes method#

Sets the attributes for an endpoint for a device on one of the supported push notification services, such as GCM (Firebase Cloud Messaging) and APNS.

Type annotations and code completion for boto3.resource("sns").set_attributes method. boto3 documentation

# set_attributes method definition

def set_attributes(
    self,
    *,
    Attributes: Mapping[str, str],
) -> None:
    ...
# set_attributes method usage example with argument unpacking

kwargs: SetEndpointAttributesInputPlatformEndpointSetAttributesTypeDef = {  # (1)
    "Attributes": ...,
}

parent.set_attributes(**kwargs)
  1. See SetEndpointAttributesInputPlatformEndpointSetAttributesTypeDef

PlatformEndpoint.load method#

Type annotations and code completion for boto3.resource("sns").load method. boto3 documentation

# load method definition

def load(
    self,
) -> None:
    ...

PlatformEndpoint.reload method#

Type annotations and code completion for boto3.resource("sns").reload method. boto3 documentation

# reload method definition

def reload(
    self,
) -> None:
    ...

Subscription#

Type annotations and code completion for boto3.resource("sns").Subscription class. boto3 documentation

# Subscription usage example

from types_boto3_sns.service_resource import Subscription

def get_resource() -> Subscription:
    return boto3.resource("sns").Subscription(...)

Subscription attributes#

  • arn: str
  • attributes: dict[str, str]
  • meta: SNSResourceMeta

Subscription methods#

Subscription.get_available_subresources method#

Returns a list of all the available sub-resources for this Subscription.

Type annotations and code completion for boto3.resource("sns").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Subscription.delete method#

Deletes a subscription.

Type annotations and code completion for boto3.resource("sns").delete method. boto3 documentation

# delete method definition

def delete(
    self,
) -> None:
    ...

Subscription.set_attributes method#

Allows a subscription owner to set an attribute of the subscription to a new value.

Type annotations and code completion for boto3.resource("sns").set_attributes method. boto3 documentation

# set_attributes method definition

def set_attributes(
    self,
    *,
    AttributeName: str,
    AttributeValue: str = ...,
) -> None:
    ...
# set_attributes method usage example with argument unpacking

kwargs: SetSubscriptionAttributesInputSubscriptionSetAttributesTypeDef = {  # (1)
    "AttributeName": ...,
}

parent.set_attributes(**kwargs)
  1. See SetSubscriptionAttributesInputSubscriptionSetAttributesTypeDef

Subscription.load method#

Type annotations and code completion for boto3.resource("sns").load method. boto3 documentation

# load method definition

def load(
    self,
) -> None:
    ...

Subscription.reload method#

Type annotations and code completion for boto3.resource("sns").reload method. boto3 documentation

# reload method definition

def reload(
    self,
) -> None:
    ...

Topic#

Type annotations and code completion for boto3.resource("sns").Topic class. boto3 documentation

# Topic usage example

from types_boto3_sns.service_resource import Topic

def get_resource() -> Topic:
    return boto3.resource("sns").Topic(...)

Topic attributes#

  • arn: str
  • subscriptions: TopicSubscriptionsCollection
  • attributes: dict[str, str]
  • meta: SNSResourceMeta

Topic collections#

Topic.subscriptions#

Provides access to Subscription resource.

Type annotations and code completion for boto3.resource("sns").Topic(...).subscriptions collection. boto3 documentation

# TopicSubscriptionsCollection usage example

from types_boto3_sns.service_resource import TopicSubscriptionsCollection

def get_collection() -> TopicSubscriptionsCollection:
    resource = boto3.resource("sns").Topic(...)
    return resource.subscriptions

Topic methods#

Topic.get_available_subresources method#

Returns a list of all the available sub-resources for this Topic.

Type annotations and code completion for boto3.resource("sns").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Topic.add_permission method#

Adds a statement to a topic's access control policy, granting access for the specified Amazon Web Services accounts to the specified actions.

Type annotations and code completion for boto3.resource("sns").add_permission method. boto3 documentation

# add_permission method definition

def add_permission(
    self,
    *,
    Label: str,
    AWSAccountId: Sequence[str],
    ActionName: Sequence[str],
) -> None:
    ...
# add_permission method usage example with argument unpacking

kwargs: AddPermissionInputTopicAddPermissionTypeDef = {  # (1)
    "Label": ...,
    "AWSAccountId": ...,
    "ActionName": ...,
}

parent.add_permission(**kwargs)
  1. See AddPermissionInputTopicAddPermissionTypeDef

Topic.confirm_subscription method#

Verifies an endpoint owner's intent to receive messages by validating the token sent to the endpoint by an earlier Subscribe action.

Type annotations and code completion for boto3.resource("sns").confirm_subscription method. boto3 documentation

# confirm_subscription method definition

def confirm_subscription(
    self,
    *,
    Token: str,
    AuthenticateOnUnsubscribe: str = ...,
) -> _Subscription:
    ...
# confirm_subscription method usage example with argument unpacking

kwargs: ConfirmSubscriptionInputTopicConfirmSubscriptionTypeDef = {  # (1)
    "Token": ...,
}

parent.confirm_subscription(**kwargs)
  1. See ConfirmSubscriptionInputTopicConfirmSubscriptionTypeDef

Topic.delete method#

Deletes a topic and all its subscriptions.

Type annotations and code completion for boto3.resource("sns").delete method. boto3 documentation

# delete method definition

def delete(
    self,
) -> None:
    ...

Topic.publish method#

Sends a message to an Amazon SNS topic, a text message (SMS message) directly to a phone number, or a message to a mobile platform endpoint (when you specify the TargetArn).

Type annotations and code completion for boto3.resource("sns").publish method. boto3 documentation

# publish method definition

def publish(
    self,
    *,
    Message: str,
    TargetArn: str = ...,
    PhoneNumber: str = ...,
    Subject: str = ...,
    MessageStructure: str = ...,
    MessageAttributes: Mapping[str, MessageAttributeValueTypeDef] = ...,  # (1)
    MessageDeduplicationId: str = ...,
    MessageGroupId: str = ...,
) -> PublishResponseTypeDef:  # (2)
    ...
  1. See MessageAttributeValueTypeDef
  2. See PublishResponseTypeDef
# publish method usage example with argument unpacking

kwargs: PublishInputTopicPublishTypeDef = {  # (1)
    "Message": ...,
}

parent.publish(**kwargs)
  1. See PublishInputTopicPublishTypeDef

Topic.remove_permission method#

Removes a statement from a topic's access control policy.

Type annotations and code completion for boto3.resource("sns").remove_permission method. boto3 documentation

# remove_permission method definition

def remove_permission(
    self,
    *,
    Label: str,
) -> None:
    ...
# remove_permission method usage example with argument unpacking

kwargs: RemovePermissionInputTopicRemovePermissionTypeDef = {  # (1)
    "Label": ...,
}

parent.remove_permission(**kwargs)
  1. See RemovePermissionInputTopicRemovePermissionTypeDef

Topic.set_attributes method#

Allows a topic owner to set an attribute of the topic to a new value.

Type annotations and code completion for boto3.resource("sns").set_attributes method. boto3 documentation

# set_attributes method definition

def set_attributes(
    self,
    *,
    AttributeName: str,
    AttributeValue: str = ...,
) -> None:
    ...
# set_attributes method usage example with argument unpacking

kwargs: SetTopicAttributesInputTopicSetAttributesTypeDef = {  # (1)
    "AttributeName": ...,
}

parent.set_attributes(**kwargs)
  1. See SetTopicAttributesInputTopicSetAttributesTypeDef

Topic.subscribe method#

Subscribes an endpoint to an Amazon SNS topic.

Type annotations and code completion for boto3.resource("sns").subscribe method. boto3 documentation

# subscribe method definition

def subscribe(
    self,
    *,
    Protocol: str,
    Endpoint: str = ...,
    Attributes: Mapping[str, str] = ...,
    ReturnSubscriptionArn: bool = ...,
) -> _Subscription:
    ...
# subscribe method usage example with argument unpacking

kwargs: SubscribeInputTopicSubscribeTypeDef = {  # (1)
    "Protocol": ...,
}

parent.subscribe(**kwargs)
  1. See SubscribeInputTopicSubscribeTypeDef

Topic.load method#

Type annotations and code completion for boto3.resource("sns").load method. boto3 documentation

# load method definition

def load(
    self,
) -> None:
    ...

Topic.reload method#

Type annotations and code completion for boto3.resource("sns").reload method. boto3 documentation

# reload method definition

def reload(
    self,
) -> None:
    ...