Skip to content

delete_campaign async

delete_campaign(
    catalog: Catalog,
    campaign_identifier: CampaignIdentifier,
    *,
    config_overrides: Optional[AsyncPartnerCentralMarketingClientConfig] = None,
) -> None

Permanently deletes a campaign, its assets and their stored files. A hard delete with no undo: the campaign leaves ListCampaigns and every read of it returns ResourceNotFoundException. Its tags are removed with it. Refused with ConflictException while the campaign has a live asset (CAMPAIGN_HAS_ACTIVE_ASSETS), because deleting the record would orphan what the delivery platform still serves or sends: deactivate those assets first. Also refused while an activation task is running (CAMPAIGN_ACTIVATION_IN_PROGRESS). A completed campaign can be deleted. Idempotent in effect: deleting a campaign that is already gone returns ResourceNotFoundException, and nothing is left behind by a retry.

Parameters:

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action. An IAM denial carries no Reason. A refusal for the caller's Partner Central state carries one, so a client tells the two apart by its presence.

  • InternalServerException –

    An unexpected error occurred during the processing of the request.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service. A caller branches on Reason, and where the rejection is attributable to particular fields it reads FieldList rather than parsing Message, which is prose and may change.

  • ConflictException –

    The request conflicts with the current state of the resource.

  • ResourceNotFoundException –

    The specified resource does not exist.

  • UnknownServiceError –

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

Examples:

Delete a campaign

>>> await client.delete_campaign(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w')
Source code in docs_src/capo_partnercentral_marketing/_services/async_partner_central_marketing.py
async def delete_campaign(
    self,
    catalog: "capo_partnercentral_marketing.types.catalog.Catalog",
    campaign_identifier: "capo_partnercentral_marketing.types.campaign_identifier.CampaignIdentifier",
    *,
    config_overrides: Optional[AsyncPartnerCentralMarketingClientConfig] = None,
) -> None:
    """Permanently deletes a campaign, its assets and their stored files. A hard delete with no undo: the campaign leaves ListCampaigns and every read of it returns ResourceNotFoundException. Its tags are removed with it. Refused with ConflictException while the campaign has a live asset (`CAMPAIGN_HAS_ACTIVE_ASSETS`), because deleting the record would orphan what the delivery platform still serves or sends: deactivate those assets first. Also refused while an activation task is running (`CAMPAIGN_ACTIVATION_IN_PROGRESS`). A completed campaign can be deleted. Idempotent in effect: deleting a campaign that is already gone returns ResourceNotFoundException, and nothing is left behind by a retry.

    Args:
        catalog: The catalog (AWS or Sandbox).
        campaign_identifier: The campaign to delete.

    Raises:
        capo_partnercentral_marketing.errors.access_denied_exception.AccessDeniedException: You do not have sufficient access to perform this action. An IAM denial carries no `Reason`. A refusal for the caller's Partner Central state carries one, so a client tells the two apart by its presence.
        capo_partnercentral_marketing.errors.internal_server_exception.InternalServerException: An unexpected error occurred during the processing of the request.
        capo_partnercentral_marketing.errors.throttling_exception.ThrottlingException: The request was denied due to request throttling.
        capo_partnercentral_marketing.errors.validation_exception.ValidationException: The input fails to satisfy the constraints specified by the service. A caller branches on `Reason`, and where the rejection is attributable to particular fields it reads `FieldList` rather than parsing `Message`, which is prose and may change.
        capo_partnercentral_marketing.errors.conflict_exception.ConflictException: The request conflicts with the current state of the resource.
        capo_partnercentral_marketing.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        capo_partnercentral_marketing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Delete a campaign

        >>> await client.delete_campaign(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_partnercentral_marketing.types.delete_campaign_request.DeleteCampaignRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_partnercentral_marketing._operations.aws_partner_demand_generator.delete_campaign

        (
            output,
            http_response,
        ) = await capo_partnercentral_marketing._operations.aws_partner_demand_generator.delete_campaign.async_delete_campaign(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteCampaign")
    )
    input_: capo_partnercentral_marketing.types.delete_campaign_request.DeleteCampaignRequest = {
        "catalog": catalog,
        "campaign_identifier": campaign_identifier,
    }

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