Skip to content

set_endpoint_attributes async

set_endpoint_attributes(
    endpoint_arn: String,
    attributes: MapStringToString,
    *,
    config_overrides: Optional[AsyncSNSClientConfig] = None,
) -> None

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. For more information, see Using Amazon SNS Mobile Push Notifications.

Parameters:

  • endpoint_arn (String) –

    EndpointArn used for SetEndpointAttributes action.

  • attributes (MapStringToString) –

    A map of the endpoint attributes. Attributes in this map include the following:

    • CustomUserData – arbitrary user data to associate with the endpoint. Amazon SNS does not use this data. The data must be in UTF-8 format and less than 2KB.

    • Enabled – flag that enables/disables delivery to the endpoint. Amazon SNS will set this to false when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it back to true, typically after updating Token.

    • Token – device token, also referred to as a registration id, for an app and mobile device. This is returned from the notification service when an app and mobile device are registered with the notification service.

Raises:

Source code in docs_src/capo_sns/_services/async_sns.py
async def set_endpoint_attributes(
    self,
    endpoint_arn: "capo_sns.types.string.String",
    attributes: "capo_sns.types.map_string_to_string.MapStringToString",
    *,
    config_overrides: Optional[AsyncSNSClientConfig] = None,
) -> None:
    """<p>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. For more information, see <a href="https://docs.aws.amazon.com/sns/latest/dg/SNSMobilePush.html">Using Amazon SNS Mobile Push Notifications</a>. </p>

    Args:
        endpoint_arn: <p>EndpointArn used for <code>SetEndpointAttributes</code> action.</p>
        attributes: <p>A map of the endpoint attributes. Attributes in this map include the following:</p> <ul> <li> <p> <code>CustomUserData</code> – arbitrary user data to associate with the endpoint. Amazon SNS does not use this data. The data must be in UTF-8 format and less than 2KB.</p> </li> <li> <p> <code>Enabled</code> – flag that enables/disables delivery to the endpoint. Amazon SNS will set this to false when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it back to true, typically after updating Token.</p> </li> <li> <p> <code>Token</code> – device token, also referred to as a registration id, for an app and mobile device. This is returned from the notification service when an app and mobile device are registered with the notification service.</p> </li> </ul>

    Raises:
        capo_sns.errors.authorization_error_exception.AuthorizationErrorException: <p>Indicates that the user has been denied access to the requested resource.</p>
        capo_sns.errors.internal_error_exception.InternalErrorException: <p>Indicates an internal service error.</p>
        capo_sns.errors.invalid_parameter_exception.InvalidParameterException: <p>Indicates that a request parameter does not comply with the associated constraints.</p>
        capo_sns.errors.not_found_exception.NotFoundException: <p>Indicates that the requested resource does not exist.</p>
        capo_sns.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sns.types.set_endpoint_attributes_input.SetEndpointAttributesInput]",
    ) -> AsyncOperationResponse[None]:
        import capo_sns._operations.amazon_simple_notification_service.set_endpoint_attributes

        (
            output,
            http_response,
        ) = await capo_sns._operations.amazon_simple_notification_service.set_endpoint_attributes.async_set_endpoint_attributes(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SetEndpointAttributes")
    )
    input_: capo_sns.types.set_endpoint_attributes_input.SetEndpointAttributesInput = {
        "endpoint_arn": endpoint_arn,
        "attributes": attributes,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output