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

hub.exec.boto3.client.chime.delete_voice_connector_streaming_configuration
hub.exec.boto3.client.chime.get_voice_connector_streaming_configuration
hub.exec.boto3.client.chime.put_voice_connector_streaming_configuration
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, voice_connector_id: Text, streaming_configuration: Dict)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Adds a streaming configuration for the specified Amazon Chime Voice Connector. The streaming configuration
    specifies whether media streaming is enabled for sending to Indonesians. It also sets the retention period, in
    hours, for the Amazon Kinesis data.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        voice_connector_id(Text): The Amazon Chime Voice Connector ID.
        streaming_configuration(Dict): The streaming configuration details to add.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.chime.voice_connector_streaming_configuration.present:
                - name: value
                - voice_connector_id: value
                - streaming_configuration: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.chime.voice_connector_streaming_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.chime.get_voice_connector_streaming_configuration(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.chime.put_voice_connector_streaming_configuration(
                ctx,
                
                
                **{"VoiceConnectorId": voice_connector_id, "StreamingConfiguration": streaming_configuration}
            )
            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.chime.get_voice_connector_streaming_configuration(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, voice_connector_id: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes the streaming configuration for the specified Amazon Chime Voice Connector.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        voice_connector_id(Text): The Amazon Chime Voice Connector ID.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.chime.voice_connector_streaming_configuration.absent:
                - name: value
                - voice_connector_id: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.chime.voice_connector_streaming_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.chime.get_voice_connector_streaming_configuration(name)

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

