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

hub.exec.boto3.client.ses.clone_receipt_rule_set
hub.exec.boto3.client.ses.create_receipt_rule_set
hub.exec.boto3.client.ses.delete_receipt_rule_set
hub.exec.boto3.client.ses.describe_receipt_rule_set
hub.exec.boto3.client.ses.list_receipt_rule_sets
hub.exec.boto3.client.ses.reorder_receipt_rule_set
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, rule_set_name: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates an empty receipt rule set. For information about setting up receipt rule 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.
        rule_set_name(Text): The name of the rule set to create. The name must:   This value can only contain ASCII letters
            (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).   Start and end with a letter or
            number.   Contain less than 64 characters.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.ses.receipt_rule_set.present:
                - name: value
                - rule_set_name: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.ses.receipt_rule_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_receipt_rule_set(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.ses.create_receipt_rule_set(
                ctx,
                
                
                **{"RuleSetName": rule_set_name}
            )
            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_receipt_rule_set(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, rule_set_name: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes the specified receipt rule set and all of the receipt rules it contains.  The currently active rule set
    cannot be deleted.  For information about managing receipt rule 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.
        rule_set_name(Text): The name of the receipt rule set to delete.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.ses.receipt_rule_set.absent:
                - name: value
                - rule_set_name: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.ses.receipt_rule_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_receipt_rule_set(name)

    if not before:
        result["comment"] = f"'{name}' already absent"
    else:
        try:
            ret = await hub.exec.boto3.client.ses.delete_receipt_rule_set(
                ctx,
                
                
                **{"RuleSetName": rule_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_receipt_rule_set(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

