Skip to content

cancel_channel_contract async

cancel_channel_contract(
    catalog: Catalog,
    identifier: ChannelContractIdentifier,
    *,
    config_overrides: Optional[AsyncPartnerCentralChannelClientConfig] = None,
    reason: Optional[CancellationReason] = None,
    client_token: Optional[ClientToken] = None,
) -> CancelChannelContractResponse

Cancels a pending channel contract created within the last 30 days. A request for a channel contract that isn't PENDING, including one that is already CANCELED, fails with a ValidationException.

Parameters:

  • catalog (Catalog) –

    The catalog identifier for the channel contract.

  • identifier (ChannelContractIdentifier) –

    The unique identifier of the channel contract to cancel.

  • reason (Optional[CancellationReason], default: None ) –

    The reason for canceling the channel contract. Later requests don't change or remove it.

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

    A unique, case-sensitive identifier to ensure idempotency of the request.

Raises:

Examples:

Example for CancelChannelContract

>>> await client.cancel_channel_contract(catalog='AWS', identifier='cc-4fj3bd2o3vb91', reason='No longer providing managed services for this customer', client_token='clientToken')
Source code in docs_src/capo_partnercentral_channel/_services/async_partner_central_channel.py
async def cancel_channel_contract(
    self,
    catalog: "capo_partnercentral_channel.types.catalog.Catalog",
    identifier: "capo_partnercentral_channel.types.channel_contract_identifier.ChannelContractIdentifier",
    *,
    config_overrides: Optional[AsyncPartnerCentralChannelClientConfig] = None,
    reason: Optional[
        "capo_partnercentral_channel.types.cancellation_reason.CancellationReason"
    ] = None,
    client_token: Optional[
        "capo_partnercentral_channel.types.client_token.ClientToken"
    ] = None,
) -> "capo_partnercentral_channel.types.cancel_channel_contract_response.CancelChannelContractResponse":
    """<p>Cancels a pending channel contract created within the last 30 days. A request for a channel contract that isn't PENDING, including one that is already CANCELED, fails with a ValidationException.</p>

    Args:
        catalog: <p>The catalog identifier for the channel contract.</p>
        identifier: <p>The unique identifier of the channel contract to cancel.</p>
        reason: <p>The reason for canceling the channel contract. Later requests don't change or remove it.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure idempotency of the request.</p>

    Raises:
        capo_partnercentral_channel.errors.access_denied_exception.AccessDeniedException: <p>The request was denied due to insufficient permissions.</p>
        capo_partnercentral_channel.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred while processing the request.</p>
        capo_partnercentral_channel.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_partnercentral_channel.errors.throttling_exception.ThrottlingException: <p>The request was throttled due to too many requests being sent in a short period.</p>
        capo_partnercentral_channel.errors.validation_exception.ValidationException: <p>The request failed validation due to invalid input parameters.</p>
        capo_partnercentral_channel.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
        capo_partnercentral_channel.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Example for CancelChannelContract

        >>> await client.cancel_channel_contract(catalog='AWS', identifier='cc-4fj3bd2o3vb91', reason='No longer providing managed services for this customer', client_token='clientToken')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_partnercentral_channel.types.cancel_channel_contract_request.CancelChannelContractRequest]",
    ) -> AsyncOperationResponse[
        "capo_partnercentral_channel.types.cancel_channel_contract_response.CancelChannelContractResponse"
    ]:
        import capo_partnercentral_channel._operations.partner_central_channel.cancel_channel_contract

        (
            output,
            http_response,
        ) = await capo_partnercentral_channel._operations.partner_central_channel.cancel_channel_contract.async_cancel_channel_contract(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelChannelContract")
    )
    input_: capo_partnercentral_channel.types.cancel_channel_contract_request.CancelChannelContractRequest = {
        "catalog": catalog,
        "identifier": identifier,
    }
    if reason is not None:
        input_["reason"] = reason
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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