Skip to content

SNSServiceResource

Index > SNS > SNSServiceResource

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

SNSServiceResource

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

Usage example
from mypy_boto3_sns.service_resource import SNSServiceResource

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

Attributes

Collections

ServiceResourcePlatformApplicationsCollection

Provides access to PlatformApplication resource.

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

Usage example
from mypy_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

Usage example
from mypy_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

Usage example
from mypy_boto3_sns.service_resource import ServiceResourceTopicsCollection

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

Methods

SNSServiceResource.PlatformApplication method

Creates a PlatformApplication resource.

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

Method definition
def PlatformApplication(
    self,
    arn: str,
) -> PlatformApplication:
    ...
Usage example with kwargs
kwargs: ServiceResourcePlatformApplicationRequestTypeDef = {  # (1)
    "arn": ...,
}

parent.PlatformApplication(**kwargs)
  1. See ServiceResourcePlatformApplicationRequestTypeDef

SNSServiceResource.PlatformEndpoint method

Creates a PlatformEndpoint resource.

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

Method definition
def PlatformEndpoint(
    self,
    arn: str,
) -> PlatformEndpoint:
    ...
Usage example with kwargs
kwargs: ServiceResourcePlatformEndpointRequestTypeDef = {  # (1)
    "arn": ...,
}

parent.PlatformEndpoint(**kwargs)
  1. See ServiceResourcePlatformEndpointRequestTypeDef

SNSServiceResource.Subscription method

Creates a Subscription resource.

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

Method definition
def Subscription(
    self,
    arn: str,
) -> Subscription:
    ...
Usage example with kwargs
kwargs: ServiceResourceSubscriptionRequestTypeDef = {  # (1)
    "arn": ...,
}

parent.Subscription(**kwargs)
  1. See ServiceResourceSubscriptionRequestTypeDef

SNSServiceResource.Topic method

Creates a Topic resource.

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

Method definition
def Topic(
    self,
    arn: str,
) -> Topic:
    ...
Usage example with kwargs
kwargs: ServiceResourceTopicRequestTypeDef = {  # (1)
    "arn": ...,
}

parent.Topic(**kwargs)
  1. See ServiceResourceTopicRequestTypeDef

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

Method definition
def create_platform_application(
    self,
    *,
    Name: str,
    Platform: str,
    Attributes: Mapping[str, str],
) -> PlatformApplication:
    ...
Usage example with kwargs
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

Method definition
def create_topic(
    self,
    *,
    Name: str,
    Attributes: Mapping[str, str] = ...,
    Tags: Sequence[TagTypeDef] = ...,  # (1)
    DataProtectionPolicy: str = ...,
) -> Topic:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTopicInputServiceResourceCreateTopicTypeDef = {  # (1)
    "Name": ...,
}

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

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

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

PlatformApplication

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

Usage example
from mypy_boto3_sns.service_resource import PlatformApplication

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

PlatformApplication attributes

PlatformApplication collections

PlatformApplication.endpoints

Provides access to PlatformEndpoint resource.

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

Usage example
from mypy_boto3_sns.service_resource import PlatformApplicationEndpointsCollection

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

PlatformApplication methods

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

Method definition
def create_platform_endpoint(
    self,
    *,
    Token: str,
    CustomUserData: str = ...,
    Attributes: Mapping[str, str] = ...,
) -> PlatformEndpoint:
    ...
Usage example with kwargs
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

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

PlatformApplication.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

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

PlatformApplication.load method

Calls 🇵🇾meth:SNS.Client.get_platform_application_attributes to update the attributes of the PlatformApplication resource.

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

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

PlatformApplication.reload method

Calls 🇵🇾meth:SNS.Client.get_platform_application_attributes to update the attributes of the PlatformApplication resource.

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

Method definition
def reload(
    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

Method definition
def set_attributes(
    self,
    *,
    Attributes: Mapping[str, str],
) -> None:
    ...
Usage example with kwargs
kwargs: SetPlatformApplicationAttributesInputPlatformApplicationSetAttributesTypeDef = {  # (1)
    "Attributes": ...,
}

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

PlatformEndpoint

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

Usage example
from mypy_boto3_sns.service_resource import PlatformEndpoint

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

PlatformEndpoint attributes

  • attributes: Dict[str, str]
  • arn: str

PlatformEndpoint methods

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

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

PlatformEndpoint.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

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

PlatformEndpoint.load method

Calls 🇵🇾meth:SNS.Client.get_endpoint_attributes to update the attributes of the PlatformEndpoint resource.

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

Method definition
def load(
    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

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
Usage example with kwargs
kwargs: PublishInputPlatformEndpointPublishTypeDef = {  # (1)
    "Message": ...,
}

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

PlatformEndpoint.reload method

Calls 🇵🇾meth:SNS.Client.get_endpoint_attributes to update the attributes of the PlatformEndpoint resource.

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

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

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

Method definition
def set_attributes(
    self,
    *,
    Attributes: Mapping[str, str],
) -> None:
    ...
Usage example with kwargs
kwargs: SetEndpointAttributesInputPlatformEndpointSetAttributesTypeDef = {  # (1)
    "Attributes": ...,
}

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

Subscription

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

Usage example
from mypy_boto3_sns.service_resource import Subscription

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

Subscription attributes

  • attributes: Dict[str, str]
  • arn: str

Subscription methods

Subscription.delete method

Deletes a subscription.

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

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

Subscription.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

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

Subscription.load method

Calls 🇵🇾meth:SNS.Client.get_subscription_attributes to update the attributes of the Subscription resource.

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

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

Subscription.reload method

Calls 🇵🇾meth:SNS.Client.get_subscription_attributes to update the attributes of the Subscription resource.

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

Method definition
def reload(
    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

Method definition
def set_attributes(
    self,
    *,
    AttributeName: str,
    AttributeValue: str = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: SetSubscriptionAttributesInputSubscriptionSetAttributesTypeDef = {  # (1)
    "AttributeName": ...,
}

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

Topic

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

Usage example
from mypy_boto3_sns.service_resource import Topic

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

Topic attributes

Topic collections

Topic.subscriptions

Provides access to Subscription resource.

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

Usage example
from mypy_boto3_sns.service_resource import TopicSubscriptionsCollection

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

Topic methods

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

Method definition
def add_permission(
    self,
    *,
    Label: str,
    AWSAccountId: Sequence[str],
    ActionName: Sequence[str],
) -> None:
    ...
Usage example with kwargs
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

Method definition
def confirm_subscription(
    self,
    *,
    Token: str,
    AuthenticateOnUnsubscribe: str = ...,
) -> Subscription:
    ...
Usage example with kwargs
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

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

Topic.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

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

Topic.load method

Calls 🇵🇾meth:SNS.Client.get_topic_attributes to update the attributes of the Topic resource.

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

Method definition
def load(
    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

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
Usage example with kwargs
kwargs: PublishInputTopicPublishTypeDef = {  # (1)
    "Message": ...,
}

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

Topic.reload method

Calls 🇵🇾meth:SNS.Client.get_topic_attributes to update the attributes of the Topic resource.

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

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

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

Method definition
def remove_permission(
    self,
    *,
    Label: str,
) -> None:
    ...
Usage example with kwargs
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

Method definition
def set_attributes(
    self,
    *,
    AttributeName: str,
    AttributeValue: str = ...,
) -> None:
    ...
Usage example with kwargs
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

Method definition
def subscribe(
    self,
    *,
    Protocol: str,
    Endpoint: str = ...,
    Attributes: Mapping[str, str] = ...,
    ReturnSubscriptionArn: bool = ...,
) -> Subscription:
    ...
Usage example with kwargs
kwargs: SubscribeInputTopicSubscribeTypeDef = {  # (1)
    "Protocol": ...,
}

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