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

hub.exec.boto3.client.devicefarm.create_vpce_configuration
hub.exec.boto3.client.devicefarm.delete_vpce_configuration
hub.exec.boto3.client.devicefarm.get_vpce_configuration
hub.exec.boto3.client.devicefarm.list_vpce_configurations
hub.exec.boto3.client.devicefarm.update_vpce_configuration
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, vpce_configuration_name: Text, vpce_service_name: Text, service_dns_name: Text, vpce_configuration_description: Text = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a configuration record in Device Farm for your Amazon Virtual Private Cloud (VPC) endpoint.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        vpce_configuration_name(Text): The friendly name you give to your VPC endpoint configuration, to manage your configurations
            more easily.
        vpce_service_name(Text): The name of the VPC endpoint service running in your AWS account that you want Device Farm to
            test.
        service_dns_name(Text): The DNS name of the service running in your VPC that you want Device Farm to test.
        vpce_configuration_description(Text, optional): An optional description that provides details about your VPC endpoint configuration. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.devicefarm.vpce_configuration.present:
                - name: value
                - vpce_configuration_name: value
                - vpce_service_name: value
                - service_dns_name: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.devicefarm.vpce_configuration.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.devicefarm.get_vpce_configuration(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.devicefarm.create_vpce_configuration(
                ctx,
                
                
                **{"vpceConfigurationName": vpce_configuration_name, "vpceServiceName": vpce_service_name, "serviceDnsName": service_dns_name, "vpceConfigurationDescription": vpce_configuration_description}
            )
            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.devicefarm.get_vpce_configuration(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, arn: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes a configuration for your Amazon Virtual Private Cloud (VPC) endpoint.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        arn(Text): The Amazon Resource Name (ARN) of the VPC endpoint configuration you want to delete.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

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

