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

hub.exec.boto3.client.neptune.copy_db_cluster_parameter_group
hub.exec.boto3.client.neptune.create_db_cluster_parameter_group
hub.exec.boto3.client.neptune.delete_db_cluster_parameter_group
hub.exec.boto3.client.neptune.describe_db_cluster_parameter_groups
hub.exec.boto3.client.neptune.modify_db_cluster_parameter_group
hub.exec.boto3.client.neptune.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 DB cluster parameter group. Parameters in a DB cluster parameter group apply to all of the
    instances in a DB cluster.  A DB cluster parameter group is initially created with the default parameters for
    the database engine used by instances in the DB cluster. To provide custom values for any of the parameters, you
    must modify the group after creating it using ModifyDBClusterParameterGroup. Once you've created a DB cluster
    parameter group, you need to associate it with your DB cluster using ModifyDBCluster. When you associate a new
    DB cluster parameter group with a running DB cluster, you need to reboot the DB instances in the DB cluster
    without failover for the new DB cluster parameter group and associated settings to take effect.  After you
    create a DB cluster parameter group, you should wait at least 5 minutes before creating your first DB cluster
    that uses that DB cluster parameter group as the default parameter group. This allows Amazon Neptune to fully
    complete the create action before the DB cluster parameter group is used as the default for a new DB cluster.
    This is especially important for parameters that are critical when creating the default database for a DB
    cluster, such as the character set for the default database defined by the character_set_database parameter. You
    can use the Parameter Groups option of the Amazon Neptune console or the DescribeDBClusterParameters command to
    verify that your DB cluster parameter group has been created or modified.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        db_cluster_parameter_group_name(Text): The name of the DB cluster parameter group. Constraints:   Must match the name of an existing
            DBClusterParameterGroup.    This value is stored as a lowercase string.
        db_parameter_group_family(Text): The DB cluster parameter group family name. A DB cluster parameter group can be associated with
            one and only one DB cluster parameter group family, and can be applied only to a DB cluster
            running a database engine and engine version compatible with that DB cluster parameter group
            family.
        description(Text): The description for the DB cluster parameter group.
        tags(List, optional): The tags to be assigned to the new DB cluster parameter group. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.neptune.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.neptune.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.neptune.describe_db_cluster_parameter_groups(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.neptune.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.neptune.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 DB cluster parameter group. The DB cluster parameter group to be deleted can't be associated
    with any DB 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 DB cluster parameter group. Constraints:   Must be the name of an existing DB
            cluster parameter group.   You can't delete a default DB cluster parameter group.   Cannot be
            associated with any DB clusters.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.neptune.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.neptune.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.neptune.describe_db_cluster_parameter_groups(name)

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

