Skip to content

remove_permission

remove_permission(
    topic_arn: topicARN,
    label: label,
    *,
    config_overrides: Optional[SNSClientConfig] = None,
) -> None

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

To remove the ability to change topic permissions, you must deny permissions to the AddPermission, RemovePermission, and SetTopicAttributes actions in your IAM policy.

Parameters:

  • topic_arn (topicARN) –

    The ARN of the topic whose access control policy you wish to modify.

  • label (label) –

    The unique label of the statement you want to remove.

Raises:

Source code in docs_src/capo_sns/_services/sns.py
def remove_permission(
    self,
    topic_arn: "capo_sns.types.topic_arn.topicARN",
    label: "capo_sns.types.label.label",
    *,
    config_overrides: Optional[SNSClientConfig] = None,
) -> None:
    """<p>Removes a statement from a topic's access control policy.</p> <note> <p>To remove the ability to change topic permissions, you must deny permissions to the <code>AddPermission</code>, <code>RemovePermission</code>, and <code>SetTopicAttributes</code> actions in your IAM policy.</p> </note>

    Args:
        topic_arn: <p>The ARN of the topic whose access control policy you wish to modify.</p>
        label: <p>The unique label of the statement you want to remove.</p>

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

    def _handler(
        req: "OperationRequest[capo_sns.types.remove_permission_input.RemovePermissionInput]",
    ) -> OperationResponse[None]:
        import capo_sns._operations.amazon_simple_notification_service.remove_permission

        output, http_response = (
            capo_sns._operations.amazon_simple_notification_service.remove_permission.remove_permission(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RemovePermission")
    )
    input_: capo_sns.types.remove_permission_input.RemovePermissionInput = {
        "topic_arn": topic_arn,
        "label": label,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output