Skip to content

create_receipt_filter async

create_receipt_filter(
    filter: ReceiptFilter, *, config_overrides: Optional[AsyncSESClientConfig] = None
) -> CreateReceiptFilterResponse

Creates a new IP address filter.

For information about setting up IP address filters, see the Amazon SES Developer Guide.

You can execute this operation no more than once per second.

Parameters:

  • filter (ReceiptFilter) –

    A data structure that describes the IP address filter to create, which consists of a name, an IP address range, and whether to allow or block mail from it.

Raises:

Examples:

CreateReceiptFilter The following example creates a new IP address filter:

>>> await client.create_receipt_filter(filter={'Name': 'MyFilter', 'IpFilter': {'Policy': 'Allow', 'Cidr': '1.2.3.4/24'}})
Source code in docs_src/capo_ses/_services/async_ses.py
async def create_receipt_filter(
    self,
    filter: "capo_ses.types.receipt_filter.ReceiptFilter",
    *,
    config_overrides: Optional[AsyncSESClientConfig] = None,
) -> "capo_ses.types.create_receipt_filter_response.CreateReceiptFilterResponse":
    """<p>Creates a new IP address filter.</p> <p>For information about setting up IP address filters, see the <a href="https://docs.aws.amazon.com/ses/latest/dg/receiving-email-ip-filtering-console-walkthrough.html">Amazon SES Developer Guide</a>.</p> <p>You can execute this operation no more than once per second.</p>

    Args:
        filter: <p>A data structure that describes the IP address filter to create, which consists of a name, an IP address range, and whether to allow or block mail from it.</p>

    Raises:
        capo_ses.errors.already_exists_exception.AlreadyExistsException: <p>Indicates that a resource could not be created because of a naming conflict.</p>
        capo_ses.errors.limit_exceeded_exception.LimitExceededException: <p>Indicates that a resource could not be created because of service limits. For a list of Amazon SES limits, see the <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/limits.html">Amazon SES Developer Guide</a>.</p>
        capo_ses.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        CreateReceiptFilter
        The following example creates a new IP address filter:

        >>> await client.create_receipt_filter(filter={'Name': 'MyFilter', 'IpFilter': {'Policy': 'Allow', 'Cidr': '1.2.3.4/24'}})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ses.types.create_receipt_filter_request.CreateReceiptFilterRequest]",
    ) -> AsyncOperationResponse[
        "capo_ses.types.create_receipt_filter_response.CreateReceiptFilterResponse"
    ]:
        import capo_ses._operations.simple_email_service.create_receipt_filter

        (
            output,
            http_response,
        ) = await capo_ses._operations.simple_email_service.create_receipt_filter.async_create_receipt_filter(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateReceiptFilter")
    )
    input_: capo_ses.types.create_receipt_filter_request.CreateReceiptFilterRequest = {
        "filter": filter
    }

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