"""
Autogenerated module using `pop-create-idem <https://gitlab.com/saltstack/pop/pop-create-idem>`__
"""
from typing import Dict
from typing import List


async def create(
    hub,
    ctx,
    mesh_name: str,
    client_token: str = None,
    spec: Dict = None,
    tags: List = None,
) -> Dict:
    r"""
    **Autogenerated function**

    Creates a service mesh.  A service mesh is a logical boundary for network traffic between services that are represented by resources within the mesh. After you create your service mesh, you can create virtual services, virtual nodes, virtual routers, and routes to distribute traffic between the applications in your mesh. For more information about service meshes, see Service meshes.

    Args:
        client_token(str, optional): Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed. Defaults to None.
        mesh_name(str): The name to use for the service mesh.
        spec(Dict, optional): The service mesh specification to apply. Defaults to None.
        tags(List, optional): Optional metadata that you can apply to the service mesh to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters. Defaults to None.

    Returns:
        Dict

    Examples:
        Call from code:

        .. code-block:: python

            await hub.exec.aws_auto.appmesh.mesh.create(ctx, mesh_name=value)

        Call from CLI:

        .. code-block:: bash

            $ idem exec aws_auto.appmesh.mesh.create mesh_name=value
    """
    return await hub.tool.aws.client.exec(
        ctx,
        service_name="appmesh",
        operation="create_mesh",
        op_kwargs={
            "clientToken": client_token,
            "meshName": mesh_name,
            "spec": spec,
            "tags": tags,
        },
    )


async def delete(hub, ctx, mesh_name: str) -> Dict:
    r"""
    **Autogenerated function**

    Deletes an existing service mesh. You must delete all resources (virtual services, routes, virtual routers, and virtual nodes) in the service mesh before you can delete the mesh itself.

    Args:
        mesh_name(str): The name of the service mesh to delete.

    Returns:
        Dict

    Examples:
        Call from code:

        .. code-block:: python

            await hub.exec.aws_auto.appmesh.mesh.delete(ctx, mesh_name=value)

        Call from CLI:

        .. code-block:: bash

            $ idem exec aws_auto.appmesh.mesh.delete mesh_name=value
    """
    return await hub.tool.aws.client.exec(
        ctx,
        service_name="appmesh",
        operation="delete_mesh",
        op_kwargs={"meshName": mesh_name},
    )


async def describe(hub, ctx, mesh_name: str, mesh_owner: str = None) -> Dict:
    r"""
    **Autogenerated function**

    Describes an existing service mesh.

    Args:
        mesh_name(str): The name of the service mesh to describe.
        mesh_owner(str, optional): The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes. Defaults to None.

    Returns:
        Dict

    Examples:
        Call from code:

        .. code-block:: python

            await hub.exec.aws_auto.appmesh.mesh.describe(ctx, mesh_name=value)

        Call from CLI:

        .. code-block:: bash

            $ idem exec aws_auto.appmesh.mesh.describe mesh_name=value
    """
    return await hub.tool.aws.client.exec(
        ctx,
        service_name="appmesh",
        operation="describe_mesh",
        op_kwargs={"meshName": mesh_name, "meshOwner": mesh_owner},
    )


async def list_all(hub, ctx, limit: int = None, next_token: str = None) -> Dict:
    r"""
    **Autogenerated function**

    Returns a list of existing service meshes.

    Args:
        limit(int, optional): The maximum number of results returned by ListMeshes in paginated output. When you use this parameter, ListMeshes returns only limit results in a single page along with a nextToken response element. You can see the remaining results of the initial request by sending another ListMeshes request with the returned nextToken value. This value can be between 1 and 100. If you don't use this parameter, ListMeshes returns up to 100 results and a nextToken value if applicable. Defaults to None.
        next_token(str, optional): The nextToken value returned from a previous paginated ListMeshes request where limit was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.  This token should be treated as an opaque identifier that is used only to retrieve the next items in a list and not for other programmatic purposes. . Defaults to None.

    Returns:
        Dict

    Examples:
        Call from code:

        .. code-block:: python

            await hub.exec.aws_auto.appmesh.mesh.list_all(ctx)

        Call from CLI:

        .. code-block:: bash

            $ idem exec aws_auto.appmesh.mesh.list_all
    """
    return await hub.tool.aws.client.exec(
        ctx,
        service_name="appmesh",
        operation="list_meshes",
        op_kwargs={"limit": limit, "nextToken": next_token},
    )


async def update(
    hub, ctx, mesh_name: str, client_token: str = None, spec: Dict = None
) -> Dict:
    r"""
    **Autogenerated function**

    Updates an existing service mesh.

    Args:
        client_token(str, optional): Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed. Defaults to None.
        mesh_name(str): The name of the service mesh to update.
        spec(Dict, optional): The service mesh specification to apply. Defaults to None.

    Returns:
        Dict

    Examples:
        Call from code:

        .. code-block:: python

            await hub.exec.aws_auto.appmesh.mesh.update(ctx, mesh_name=value)

        Call from CLI:

        .. code-block:: bash

            $ idem exec aws_auto.appmesh.mesh.update mesh_name=value
    """
    return await hub.tool.aws.client.exec(
        ctx,
        service_name="appmesh",
        operation="update_mesh",
        op_kwargs={"clientToken": client_token, "meshName": mesh_name, "spec": spec},
    )
