"""
Autogenerated state module using `pop-create-idem <https://gitlab.com/saltstack/pop/pop-create-idem>`__

hub.exec.boto3.client.ses.create_configuration_set
hub.exec.boto3.client.ses.delete_configuration_set
hub.exec.boto3.client.ses.describe_configuration_set
hub.exec.boto3.client.ses.list_configuration_sets
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, configuration_set: Dict)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a configuration set. Configuration sets enable you to publish email sending events. For information
    about using configuration sets, see the Amazon SES Developer Guide. You can execute this operation no more than
    once per second.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        configuration_set(Dict): A data structure that contains the name of the configuration set.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.ses.configuration_set.present:
                - name: value
                - configuration_set: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.ses.configuration_set.id(
        ctx,
        jmes_path=name
    )
    if ret["status"]:
        # name is now the first id that matched the JMES search path
        name = ret["ret"]
    

    
    before = await hub.exec.boto3.client.ses.describe_configuration_set(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.ses.create_configuration_set(
                ctx,
                
                
                **{"ConfigurationSet": configuration_set}
            )
            result["result"] = ret["status"]
            if not result["result"]:
                result["comment"] = ret["comment"]
                return result
            ret["comment"] = f"Created '{name}'"
        except hub.tool.boto3.exception.ClientError as e:
            result["comment"] = f"{e.__class__.__name__}: {e}"

    
    # TODO perform other modifications as needed here
    ...

    after = await hub.exec.boto3.client.ses.describe_configuration_set(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, configuration_set_name: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes a configuration set. Configuration sets enable you to publish email sending events. For information
    about using configuration sets, see the Amazon SES Developer Guide. You can execute this operation no more than
    once per second.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        configuration_set_name(Text): The name of the configuration set to delete.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.ses.configuration_set.absent:
                - name: value
                - configuration_set_name: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.ses.configuration_set.id(
        ctx,
        jmes_path=name
    )
    if ret["status"]:
        # name is now the first id that matched the JMES search path
        name = ret["ret"]
    

    

    before = await hub.exec.boto3.client.ses.describe_configuration_set(name)

    if not before:
        result["comment"] = f"'{name}' already absent"
    else:
        try:
            ret = await hub.exec.boto3.client.ses.delete_configuration_set(
                ctx,
                
                
                **{"ConfigurationSetName": configuration_set_name}
            )
            result["result"] = ret["status"]
            if not result["result"]:
                result["comment"] = ret["comment"]
                return result
            result["comment"] = f"Deleted '{name}'"
        except hub.tool.boto3.exception.ClientError as e:
            result["comment"] = f"{e.__class__.__name__}: {e}"

    

    after = await hub.exec.boto3.client.ses.describe_configuration_set(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

