View a markdown version of this page

Use DeleteConfigurationSet with an AWS SDK - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DeleteConfigurationSet with an AWS SDK

The following code example shows how to use DeleteConfigurationSet.

Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example:

Python
SDK for Python (Boto3)
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

Delete a configuration set that was created by the Amazon SES API v2 search-and-filter scenario.

class SearchFilterWrapper: """Encapsulates Amazon SES v2 search-and-filter operations.""" def __init__(self, sesv2_client: boto3.client): """ Initializes the SearchFilterWrapper with an Amazon SES v2 client. :param sesv2_client: A Boto3 Amazon SES v2 client. """ self.sesv2_client = sesv2_client @classmethod def from_client(cls) -> "SearchFilterWrapper": """ Creates a SearchFilterWrapper instance with a default Boto3 SES v2 client. :return: An initialized SearchFilterWrapper instance. """ sesv2_client = boto3.client("sesv2") return cls(sesv2_client) def delete_configuration_set(self, configuration_set_name: str) -> None: """ Deletes a configuration set. :param configuration_set_name: The name of the configuration set to delete. """ try: self.sesv2_client.delete_configuration_set( ConfigurationSetName=configuration_set_name ) logger.info("Deleted configuration set '%s'.", configuration_set_name) except ClientError as err: if err.response["Error"]["Code"] == "NotFoundException": logger.warning( "Configuration set '%s' not found. Skipping deletion.", configuration_set_name, ) else: logger.error( "Error deleting configuration set '%s': %s", configuration_set_name, err.response["Error"]["Message"], ) raise