Skip to content

put_protect_configuration_rule_set_number_override async

put_protect_configuration_rule_set_number_override(
    protect_configuration_id: ProtectConfigurationIdOrArn,
    destination_phone_number: PhoneNumber,
    action: ProtectConfigurationRuleOverrideAction,
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    expiration_timestamp: Optional[datetime] = None,
) -> PutProtectConfigurationRuleSetNumberOverrideResult

Create or update a phone number rule override and associate it with a protect configuration.

Parameters:

  • client_token (Optional[ClientToken], default: None ) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, a randomly generated token is used for the request to ensure idempotency.

  • protect_configuration_id (ProtectConfigurationIdOrArn) –

    The unique identifier for the protect configuration.

  • destination_phone_number (PhoneNumber) –

    The destination phone number in E.164 format.

  • action (ProtectConfigurationRuleOverrideAction) –

    The action for the rule to either block or allow messages to the destination phone number.

  • expiration_timestamp (Optional[datetime], default: None ) –

    The time the rule will expire at. If ExpirationTimestamp is not set then the rule does not expire.

Raises:

  • AccessDeniedException –

    The request was denied because you don't have sufficient permissions to access the resource.

  • ConflictException –

    Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.

  • InternalServerException –

    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.

  • ResourceNotFoundException –

    A requested resource couldn't be found.

  • ServiceQuotaExceededException –

    The request would cause a service quota to be exceeded.

  • ThrottlingException –

    An error that occurred because too many requests were sent during a certain amount of time.

  • ValidationException –

    A validation exception for a field.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_pinpoint_sms_voice_v2/_services/async_pinpoint_sms_voice_v2.py
async def put_protect_configuration_rule_set_number_override(
    self,
    protect_configuration_id: "capo_pinpoint_sms_voice_v2.types.protect_configuration_id_or_arn.ProtectConfigurationIdOrArn",
    destination_phone_number: "capo_pinpoint_sms_voice_v2.types.phone_number.PhoneNumber",
    action: "capo_pinpoint_sms_voice_v2.types.protect_configuration_rule_override_action.ProtectConfigurationRuleOverrideAction",
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
    client_token: Optional[
        "capo_pinpoint_sms_voice_v2.types.client_token.ClientToken"
    ] = None,
    expiration_timestamp: Optional[datetime.datetime] = None,
) -> "capo_pinpoint_sms_voice_v2.types.put_protect_configuration_rule_set_number_override_result.PutProtectConfigurationRuleSetNumberOverrideResult":
    """<p>Create or update a phone number rule override and associate it with a protect configuration.</p>

    Args:
        client_token: <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, a randomly generated token is used for the request to ensure idempotency.</p>
        protect_configuration_id: <p>The unique identifier for the protect configuration.</p>
        destination_phone_number: <p>The destination phone number in E.164 format.</p>
        action: <p>The action for the rule to either block or allow messages to the destination phone number.</p>
        expiration_timestamp: <p>The time the rule will expire at. If <code>ExpirationTimestamp</code> is not set then the rule does not expire.</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.conflict_exception.ConflictException: <p>Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of 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.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_pinpoint_sms_voice_v2.types.put_protect_configuration_rule_set_number_override_request.PutProtectConfigurationRuleSetNumberOverrideRequest]",
    ) -> AsyncOperationResponse[
        "capo_pinpoint_sms_voice_v2.types.put_protect_configuration_rule_set_number_override_result.PutProtectConfigurationRuleSetNumberOverrideResult"
    ]:
        import capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.put_protect_configuration_rule_set_number_override

        (
            output,
            http_response,
        ) = await capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.put_protect_configuration_rule_set_number_override.async_put_protect_configuration_rule_set_number_override(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("PutProtectConfigurationRuleSetNumberOverride"),
    )
    input_: capo_pinpoint_sms_voice_v2.types.put_protect_configuration_rule_set_number_override_request.PutProtectConfigurationRuleSetNumberOverrideRequest = {
        "protect_configuration_id": protect_configuration_id,
        "destination_phone_number": destination_phone_number,
        "action": action,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if expiration_timestamp is not None:
        input_["expiration_timestamp"] = expiration_timestamp

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