Skip to content

send_agreement_cancellation_request async

send_agreement_cancellation_request(
    agreement_id: AgreementId,
    reason_code: AgreementCancellationRequestReasonCode,
    *,
    config_overrides: Optional[AsyncMarketplaceAgreementClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    description: Optional[AgreementCancellationRequestDescription] = None,
) -> SendAgreementCancellationRequestOutput

Allows sellers (proposers) to submit a cancellation request for an active agreement. The cancellation request is created in PENDING_APPROVAL status, at which point the buyer can review it.

Parameters:

Raises:

Examples:

Send a cancellation request

>>> await client.send_agreement_cancellation_request(agreement_id='agmt-752jqvg74yo7k4h56cakk6396', reason_code='OTHER', description='Due to budget constraints, we are unable to continue with our current subscription', client_token='53nQSKWt6AjrsiZPhzQyZT')
Source code in docs_src/capo_marketplace_agreement/_services/async_marketplace_agreement.py
async def send_agreement_cancellation_request(
    self,
    agreement_id: "capo_marketplace_agreement.types.agreement_id.AgreementId",
    reason_code: "capo_marketplace_agreement.types.agreement_cancellation_request_reason_code.AgreementCancellationRequestReasonCode",
    *,
    config_overrides: Optional[AsyncMarketplaceAgreementClientConfig] = None,
    client_token: Optional[
        "capo_marketplace_agreement.types.client_token.ClientToken"
    ] = None,
    description: Optional[
        "capo_marketplace_agreement.types.agreement_cancellation_request_description.AgreementCancellationRequestDescription"
    ] = None,
) -> "capo_marketplace_agreement.types.send_agreement_cancellation_request_output.SendAgreementCancellationRequestOutput":
    """<p>Allows sellers (proposers) to submit a cancellation request for an active agreement. The cancellation request is created in <code>PENDING_APPROVAL</code> status, at which point the buyer can review it.</p>

    Args:
        agreement_id: <p>The unique identifier of the agreement for which the cancellation request is being submitted.</p>
        reason_code: <p>The reason code for the cancellation request.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
        description: <p>An optional detailed description of the cancellation reason (1-2000 characters).</p>

    Raises:
        capo_marketplace_agreement.errors.access_denied_exception.AccessDeniedException: <p>User does not have sufficient access to perform this action.</p>
        capo_marketplace_agreement.errors.conflict_exception.ConflictException: <p>Request was denied due to a resource conflict.</p>
        capo_marketplace_agreement.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of request.</p>
        capo_marketplace_agreement.errors.resource_not_found_exception.ResourceNotFoundException: <p>Request references a resource which does not exist.</p>
        capo_marketplace_agreement.errors.throttling_exception.ThrottlingException: <p>Request was denied due to request throttling.</p>
        capo_marketplace_agreement.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_marketplace_agreement.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Send a cancellation request

        >>> await client.send_agreement_cancellation_request(agreement_id='agmt-752jqvg74yo7k4h56cakk6396', reason_code='OTHER', description='Due to budget constraints, we are unable to continue with our current subscription', client_token='53nQSKWt6AjrsiZPhzQyZT')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_marketplace_agreement.types.send_agreement_cancellation_request_input.SendAgreementCancellationRequestInput]",
    ) -> AsyncOperationResponse[
        "capo_marketplace_agreement.types.send_agreement_cancellation_request_output.SendAgreementCancellationRequestOutput"
    ]:
        import capo_marketplace_agreement._operations.awsmp_commerce_service_v20200301.send_agreement_cancellation_request

        (
            output,
            http_response,
        ) = await capo_marketplace_agreement._operations.awsmp_commerce_service_v20200301.send_agreement_cancellation_request.async_send_agreement_cancellation_request(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_marketplace_agreement.types.send_agreement_cancellation_request_input.SendAgreementCancellationRequestInput",
    ) -> dict[str, Any]:
        import capo_marketplace_agreement.types.send_agreement_cancellation_request_input

        return capo_marketplace_agreement.types.send_agreement_cancellation_request_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_marketplace_agreement.types.send_agreement_cancellation_request_output.SendAgreementCancellationRequestOutput",
    ) -> dict[str, Any]:
        import capo_marketplace_agreement.types.send_agreement_cancellation_request_output

        return capo_marketplace_agreement.types.send_agreement_cancellation_request_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "SendAgreementCancellationRequest",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_marketplace_agreement.types.send_agreement_cancellation_request_input.SendAgreementCancellationRequestInput = {
        "agreement_id": agreement_id,
        "reason_code": reason_code,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description

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