Skip to content

delete_campaign async

delete_campaign(
    campaign_arn: Arn,
    *,
    config_overrides: Optional[AsyncPersonalizeClientConfig] = None,
) -> None

Removes a campaign by deleting the solution deployment. The solution that the campaign is based on is not deleted and can be redeployed when needed. A deleted campaign can no longer be specified in a GetRecommendations request. For information on creating campaigns, see CreateCampaign.

Parameters:

  • campaign_arn (Arn) –

    The Amazon Resource Name (ARN) of the campaign to delete.

Raises:

Source code in docs_src/capo_personalize/_services/async_personalize.py
async def delete_campaign(
    self,
    campaign_arn: "capo_personalize.types.arn.Arn",
    *,
    config_overrides: Optional[AsyncPersonalizeClientConfig] = None,
) -> None:
    """<p>Removes a campaign by deleting the solution deployment. The solution that the campaign is based on is not deleted and can be redeployed when needed. A deleted campaign can no longer be specified in a <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html">GetRecommendations</a> request. For information on creating campaigns, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_CreateCampaign.html">CreateCampaign</a>.</p>

    Args:
        campaign_arn: <p>The Amazon Resource Name (ARN) of the campaign to delete.</p>

    Raises:
        capo_personalize.errors.invalid_input_exception.InvalidInputException: <p>Provide a valid value for the field or parameter.</p>
        capo_personalize.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
        capo_personalize.errors.resource_not_found_exception.ResourceNotFoundException: <p>Could not find the specified resource.</p>
        capo_personalize.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        (
            output,
            http_response,
        ) = await capo_personalize._operations.amazon_personalize.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_personalize.types.delete_campaign_request.DeleteCampaignRequest = {
        "campaign_arn": campaign_arn
    }

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