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

hub.exec.boto3.client.docdb.copy_db_cluster_parameter_group
hub.exec.boto3.client.docdb.create_db_cluster_parameter_group
hub.exec.boto3.client.docdb.delete_db_cluster_parameter_group
hub.exec.boto3.client.docdb.describe_db_cluster_parameter_groups
hub.exec.boto3.client.docdb.modify_db_cluster_parameter_group
hub.exec.boto3.client.docdb.reset_db_cluster_parameter_group
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, db_cluster_parameter_group_name: Text, db_parameter_group_family: Text, description: Text, tags: List = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a new cluster parameter group. Parameters in a cluster parameter group apply to all of the instances in
    a cluster. A cluster parameter group is initially created with the default parameters for the database engine
    used by instances in the cluster. In Amazon DocumentDB, you cannot make modifications directly to the
    default.docdb3.6 cluster parameter group. If your Amazon DocumentDB cluster is using the default cluster
    parameter group and you want to modify a value in it, you must first  create a new parameter group or  copy an
    existing parameter group, modify it, and then apply the modified parameter group to your cluster. For the new
    cluster parameter group and associated settings to take effect, you must then reboot the instances in the
    cluster without failover. For more information, see  Modifying Amazon DocumentDB Cluster Parameter Groups.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        db_cluster_parameter_group_name(Text): The name of the cluster parameter group. Constraints:   Must not match the name of an existing
            DBClusterParameterGroup.    This value is stored as a lowercase string.
        db_parameter_group_family(Text): The cluster parameter group family name.
        description(Text): The description for the cluster parameter group.
        tags(List, optional): The tags to be assigned to the cluster parameter group. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.docdb.db_cluster_parameter_group.present:
                - name: value
                - db_cluster_parameter_group_name: value
                - db_parameter_group_family: value
                - description: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.docdb.db_cluster_parameter_group.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.docdb.describe_db_cluster_parameter_groups(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.docdb.create_db_cluster_parameter_group(
                ctx,
                
                
                **{"DBClusterParameterGroupName": db_cluster_parameter_group_name, "DBParameterGroupFamily": db_parameter_group_family, "Description": description, "Tags": tags}
            )
            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.docdb.describe_db_cluster_parameter_groups(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, db_cluster_parameter_group_name: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes a specified cluster parameter group. The cluster parameter group to be deleted can't be associated with
    any clusters.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        db_cluster_parameter_group_name(Text): The name of the cluster parameter group. Constraints:   Must be the name of an existing cluster
            parameter group.   You can't delete a default cluster parameter group.   Cannot be associated
            with any clusters.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.docdb.db_cluster_parameter_group.absent:
                - name: value
                - db_cluster_parameter_group_name: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.docdb.db_cluster_parameter_group.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.docdb.describe_db_cluster_parameter_groups(name)

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

