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

hub.exec.boto3.client.medialive.create_input
hub.exec.boto3.client.medialive.delete_input
hub.exec.boto3.client.medialive.describe_input
hub.exec.boto3.client.medialive.list_inputs
hub.exec.boto3.client.medialive.update_input
"""



from typing import *
import dict_tools.differ as differ


__virtualname__ = "input"
async def present(hub, ctx, name: Text = None, destinations: List = None, input_devices: List = None, input_security_groups: List = None, media_connect_flows: List = None, request_id: Text = None, role_arn: Text = None, sources: List = None, tags: Dict = None, type_: Text = None, vpc: Dict = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Create an input

    Args:
        name(Text, optional): Name of the input. Defaults to None.
        destinations(List, optional): Destination settings for PUSH type inputs. Defaults to None.
        input_devices(List, optional): Settings for the devices. Defaults to None.
        input_security_groups(List, optional): A list of security groups referenced by IDs to attach to the input. Defaults to None.
        media_connect_flows(List, optional): A list of the MediaConnect Flows that you want to use in this input. You can specify as few as
            one Flow and presently, as many as two. The only requirement is when you have more than one is
            that each Flow is in a separate Availability Zone as this ensures your EML input is redundant to
            AZ issues. Defaults to None.
        request_id(Text, optional): Unique identifier of the request to ensure the request is handled exactly once in case of
            retries. Defaults to None.
        role_arn(Text, optional): The Amazon Resource Name (ARN) of the role this input assumes during and after creation. Defaults to None.
        sources(List, optional): The source URLs for a PULL-type input. Every PULL type input needs exactly two source URLs for
            redundancy. Only specify sources for PULL type Inputs. Leave Destinations empty. Defaults to None.
        tags(Dict, optional): A collection of key-value pairs. Defaults to None.
        type_(Text, optional): Placeholder documentation for InputType. Defaults to None.
        vpc(Dict, optional): Settings for a private VPC Input. When this property is specified, the input destination
            addresses will be created in a VPC rather than with public Internet addresses. This property
            requires setting the roleArn property on Input creation. Not compatible with the
            inputSecurityGroups property. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.medialive.input_.present:
                - 
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.medialive.input.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.medialive.describe_input(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.medialive.create_input(
                ctx,
                
                
                **{"Name": name, "Destinations": destinations, "InputDevices": input_devices, "InputSecurityGroups": input_security_groups, "MediaConnectFlows": media_connect_flows, "RequestId": request_id, "RoleArn": role_arn, "Sources": sources, "Tags": tags, "Type": type_, "Vpc": vpc}
            )
            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.medialive.describe_input(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, input_id: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes the input end point

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        input_id(Text): Unique ID of the input.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.medialive.input_.absent:
                - name: value
                - input_id: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.medialive.input.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.medialive.describe_input(name)

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

