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

hub.exec.boto3.client.sagemaker.create_data_quality_job_definition
hub.exec.boto3.client.sagemaker.delete_data_quality_job_definition
hub.exec.boto3.client.sagemaker.describe_data_quality_job_definition
hub.exec.boto3.client.sagemaker.list_data_quality_job_definitions
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, job_definition_name: Text, data_quality_app_specification: Dict, data_quality_job_input: Dict, data_quality_job_output_config: Dict, job_resources: Dict, role_arn: Text, data_quality_baseline_config: Dict = None, network_config: Dict = None, stopping_condition: Dict = None, tags: List = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a definition for a job that monitors data quality and drift. For information about model monitor, see
    Amazon SageMaker Model Monitor.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        job_definition_name(Text): The name for the monitoring job definition.
        data_quality_baseline_config(Dict, optional): Configures the constraints and baselines for the monitoring job. Defaults to None.
        data_quality_app_specification(Dict): Specifies the container that runs the monitoring job.
        data_quality_job_input(Dict): A list of inputs for the monitoring job. Currently endpoints are supported as monitoring inputs.
        data_quality_job_output_config(Dict): The output configuration for monitoring jobs.
        job_resources(Dict): Identifies the resources to deploy for a monitoring job.
        network_config(Dict, optional): Specifies networking configuration for the monitoring job. Defaults to None.
        role_arn(Text): The Amazon Resource Name (ARN) of an IAM role that Amazon SageMaker can assume to perform tasks
            on your behalf.
        stopping_condition(Dict, optional): A time limit for how long the monitoring job is allowed to run before stopping. Defaults to None.
        tags(List, optional): (Optional) An array of key-value pairs. For more information, see Using Cost Allocation Tags in
            the Amazon Web Services Billing and Cost Management User Guide. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.sagemaker.data_quality_job_definition.present:
                - name: value
                - job_definition_name: value
                - data_quality_app_specification: value
                - data_quality_job_input: value
                - data_quality_job_output_config: value
                - job_resources: value
                - role_arn: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.sagemaker.data_quality_job_definition.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.sagemaker.describe_data_quality_job_definition(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.sagemaker.create_data_quality_job_definition(
                ctx,
                
                
                **{"JobDefinitionName": job_definition_name, "DataQualityBaselineConfig": data_quality_baseline_config, "DataQualityAppSpecification": data_quality_app_specification, "DataQualityJobInput": data_quality_job_input, "DataQualityJobOutputConfig": data_quality_job_output_config, "JobResources": job_resources, "NetworkConfig": network_config, "RoleArn": role_arn, "StoppingCondition": stopping_condition, "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.sagemaker.describe_data_quality_job_definition(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, job_definition_name: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes a data quality monitoring job definition.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        job_definition_name(Text): The name of the data quality monitoring job definition to delete.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

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

