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

hub.exec.boto3.client.s3control.delete_storage_lens_configuration_tagging
hub.exec.boto3.client.s3control.get_storage_lens_configuration_tagging
hub.exec.boto3.client.s3control.put_storage_lens_configuration_tagging
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, config_id: Text, account_id: Text, tags: List)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Put or replace tags on an existing Amazon S3 Storage Lens configuration. For more information about S3 Storage
    Lens, see Assessing your storage activity and usage with Amazon S3 Storage Lens  in the Amazon S3 User Guide.
    To use this action, you must have permission to perform the s3:PutStorageLensConfigurationTagging action. For
    more information, see Setting permissions to use Amazon S3 Storage Lens in the Amazon S3 User Guide.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        config_id(Text): The ID of the S3 Storage Lens configuration.
        account_id(Text): The account ID of the requester.
        tags(List): The tag set of the S3 Storage Lens configuration.  You can set up to a maximum of 50 tags.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.s3control.storage_lens_configuration_tagging.present:
                - name: value
                - config_id: value
                - account_id: value
                - tags: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.s3control.storage_lens_configuration_tagging.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.s3control.get_storage_lens_configuration_tagging(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.s3control.put_storage_lens_configuration_tagging(
                ctx,
                
                
                **{"ConfigId": config_id, "AccountId": account_id, "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.s3control.get_storage_lens_configuration_tagging(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, config_id: Text, account_id: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes the Amazon S3 Storage Lens configuration tags. For more information about S3 Storage Lens, see Assessing
    your storage activity and usage with Amazon S3 Storage Lens  in the Amazon S3 User Guide.  To use this action,
    you must have permission to perform the s3:DeleteStorageLensConfigurationTagging action. For more information,
    see Setting permissions to use Amazon S3 Storage Lens in the Amazon S3 User Guide.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        config_id(Text): The ID of the S3 Storage Lens configuration.
        account_id(Text): The account ID of the requester.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.s3control.storage_lens_configuration_tagging.absent:
                - name: value
                - config_id: value
                - account_id: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.s3control.storage_lens_configuration_tagging.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.s3control.get_storage_lens_configuration_tagging(name)

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

