Skip to content

describe_opted_out_numbers

describe_opted_out_numbers(
    opt_out_list_name: OptOutListNameOrArn,
    *,
    config_overrides: Optional[PinpointSMSVoiceV2ClientConfig] = None,
    opted_out_numbers: Optional[OptedOutNumberList] = None,
    filters: Optional[OptedOutFilterList] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> DescribeOptedOutNumbersResult

Describes the specified opted out destination numbers or all opted out destination numbers in an opt-out list.

If you specify opted out numbers, the output includes information for only the specified opted out numbers. If you specify filters, the output includes information for only those opted out numbers that meet the filter criteria. If you don't specify opted out numbers or filters, the output includes information for all opted out destination numbers in your opt-out list.

If you specify an opted out number that isn't valid, an exception is returned.

Parameters:

  • opt_out_list_name (OptOutListNameOrArn) –

    The OptOutListName or OptOutListArn of the OptOutList. You can use DescribeOptOutLists to find the values for OptOutListName and OptOutListArn.

    If you are using a shared End User Messaging SMS resource then you must use the full Amazon Resource Name(ARN).

  • opted_out_numbers (Optional[OptedOutNumberList], default: None ) –

    An array of phone numbers to search for in the OptOutList.

    If you specify an opted out number that isn't valid, an exception is returned.

  • filters (Optional[OptedOutFilterList], default: None ) –

    An array of OptedOutFilter objects to filter the results on.

  • next_token (Optional[NextToken], default: None ) –

    The token to be used for the next set of paginated results. You don't need to supply a value for this field in the initial request.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return per each request.

Raises:

Source code in docs_src/capo_pinpoint_sms_voice_v2/_services/pinpoint_sms_voice_v2.py
def describe_opted_out_numbers(
    self,
    opt_out_list_name: "capo_pinpoint_sms_voice_v2.types.opt_out_list_name_or_arn.OptOutListNameOrArn",
    *,
    config_overrides: Optional[PinpointSMSVoiceV2ClientConfig] = None,
    opted_out_numbers: Optional[
        "capo_pinpoint_sms_voice_v2.types.opted_out_number_list.OptedOutNumberList"
    ] = None,
    filters: Optional[
        "capo_pinpoint_sms_voice_v2.types.opted_out_filter_list.OptedOutFilterList"
    ] = None,
    next_token: Optional[
        "capo_pinpoint_sms_voice_v2.types.next_token.NextToken"
    ] = None,
    max_results: Optional[
        "capo_pinpoint_sms_voice_v2.types.max_results.MaxResults"
    ] = None,
) -> "capo_pinpoint_sms_voice_v2.types.describe_opted_out_numbers_result.DescribeOptedOutNumbersResult":
    """<p>Describes the specified opted out destination numbers or all opted out destination numbers in an opt-out list.</p> <p>If you specify opted out numbers, the output includes information for only the specified opted out numbers. If you specify filters, the output includes information for only those opted out numbers that meet the filter criteria. If you don't specify opted out numbers or filters, the output includes information for all opted out destination numbers in your opt-out list.</p> <p>If you specify an opted out number that isn't valid, an exception is returned.</p>

    Args:
        opt_out_list_name: <p>The OptOutListName or OptOutListArn of the OptOutList. You can use <a>DescribeOptOutLists</a> to find the values for OptOutListName and OptOutListArn.</p> <important> <p>If you are using a shared End User Messaging SMS resource then you must use the full Amazon Resource Name(ARN).</p> </important>
        opted_out_numbers: <p>An array of phone numbers to search for in the OptOutList.</p> <p>If you specify an opted out number that isn't valid, an exception is returned.</p>
        filters: <p>An array of OptedOutFilter objects to filter the results on.</p>
        next_token: <p>The token to be used for the next set of paginated results. You don't need to supply a value for this field in the initial request.</p>
        max_results: <p>The maximum number of results to return per each request.</p>

    Raises:
        capo_pinpoint_sms_voice_v2.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because you don't have sufficient permissions to access the resource.</p>
        capo_pinpoint_sms_voice_v2.errors.internal_server_exception.InternalServerException: <p>The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.</p>
        capo_pinpoint_sms_voice_v2.errors.resource_not_found_exception.ResourceNotFoundException: <p>A requested resource couldn't be found.</p>
        capo_pinpoint_sms_voice_v2.errors.throttling_exception.ThrottlingException: <p>An error that occurred because too many requests were sent during a certain amount of time.</p>
        capo_pinpoint_sms_voice_v2.errors.validation_exception.ValidationException: <p>A validation exception for a field.</p>
        capo_pinpoint_sms_voice_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_pinpoint_sms_voice_v2.types.describe_opted_out_numbers_request.DescribeOptedOutNumbersRequest]",
    ) -> OperationResponse[
        "capo_pinpoint_sms_voice_v2.types.describe_opted_out_numbers_result.DescribeOptedOutNumbersResult"
    ]:
        import capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.describe_opted_out_numbers

        output, http_response = (
            capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.describe_opted_out_numbers.describe_opted_out_numbers(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeOptedOutNumbers")
    )
    input_: capo_pinpoint_sms_voice_v2.types.describe_opted_out_numbers_request.DescribeOptedOutNumbersRequest = {
        "opt_out_list_name": opt_out_list_name
    }
    if opted_out_numbers is not None:
        input_["opted_out_numbers"] = opted_out_numbers
    if filters is not None:
        input_["filters"] = filters
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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