# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from . import outputs

__all__ = [
    'GetSnapshotsResult',
    'AwaitableGetSnapshotsResult',
    'get_snapshots',
]

@pulumi.output_type
class GetSnapshotsResult:
    """
    A collection of values returned by getSnapshots.
    """
    def __init__(__self__, disk_id=None, encrypted=None, id=None, ids=None, instance_id=None, name_regex=None, names=None, output_file=None, snapshots=None, source_disk_type=None, status=None, tags=None, type=None, usage=None):
        if disk_id and not isinstance(disk_id, str):
            raise TypeError("Expected argument 'disk_id' to be a str")
        pulumi.set(__self__, "disk_id", disk_id)
        if encrypted and not isinstance(encrypted, bool):
            raise TypeError("Expected argument 'encrypted' to be a bool")
        pulumi.set(__self__, "encrypted", encrypted)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if ids and not isinstance(ids, list):
            raise TypeError("Expected argument 'ids' to be a list")
        pulumi.set(__self__, "ids", ids)
        if instance_id and not isinstance(instance_id, str):
            raise TypeError("Expected argument 'instance_id' to be a str")
        pulumi.set(__self__, "instance_id", instance_id)
        if name_regex and not isinstance(name_regex, str):
            raise TypeError("Expected argument 'name_regex' to be a str")
        pulumi.set(__self__, "name_regex", name_regex)
        if names and not isinstance(names, list):
            raise TypeError("Expected argument 'names' to be a list")
        pulumi.set(__self__, "names", names)
        if output_file and not isinstance(output_file, str):
            raise TypeError("Expected argument 'output_file' to be a str")
        pulumi.set(__self__, "output_file", output_file)
        if snapshots and not isinstance(snapshots, list):
            raise TypeError("Expected argument 'snapshots' to be a list")
        pulumi.set(__self__, "snapshots", snapshots)
        if source_disk_type and not isinstance(source_disk_type, str):
            raise TypeError("Expected argument 'source_disk_type' to be a str")
        pulumi.set(__self__, "source_disk_type", source_disk_type)
        if status and not isinstance(status, str):
            raise TypeError("Expected argument 'status' to be a str")
        pulumi.set(__self__, "status", status)
        if tags and not isinstance(tags, dict):
            raise TypeError("Expected argument 'tags' to be a dict")
        pulumi.set(__self__, "tags", tags)
        if type and not isinstance(type, str):
            raise TypeError("Expected argument 'type' to be a str")
        pulumi.set(__self__, "type", type)
        if usage and not isinstance(usage, str):
            raise TypeError("Expected argument 'usage' to be a str")
        pulumi.set(__self__, "usage", usage)

    @property
    @pulumi.getter(name="diskId")
    def disk_id(self) -> Optional[str]:
        return pulumi.get(self, "disk_id")

    @property
    @pulumi.getter
    def encrypted(self) -> Optional[bool]:
        """
        Whether the snapshot is encrypted or not.
        """
        return pulumi.get(self, "encrypted")

    @property
    @pulumi.getter
    def id(self) -> str:
        """
        The provider-assigned unique ID for this managed resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter
    def ids(self) -> Sequence[str]:
        """
        A list of snapshot IDs.
        """
        return pulumi.get(self, "ids")

    @property
    @pulumi.getter(name="instanceId")
    def instance_id(self) -> Optional[str]:
        return pulumi.get(self, "instance_id")

    @property
    @pulumi.getter(name="nameRegex")
    def name_regex(self) -> Optional[str]:
        return pulumi.get(self, "name_regex")

    @property
    @pulumi.getter
    def names(self) -> Sequence[str]:
        """
        A list of snapshots names.
        """
        return pulumi.get(self, "names")

    @property
    @pulumi.getter(name="outputFile")
    def output_file(self) -> Optional[str]:
        return pulumi.get(self, "output_file")

    @property
    @pulumi.getter
    def snapshots(self) -> Sequence['outputs.GetSnapshotsSnapshotResult']:
        """
        A list of snapshots. Each element contains the following attributes:
        """
        return pulumi.get(self, "snapshots")

    @property
    @pulumi.getter(name="sourceDiskType")
    def source_disk_type(self) -> Optional[str]:
        """
        Source disk attribute. Value range: `System`,`Data`.
        """
        return pulumi.get(self, "source_disk_type")

    @property
    @pulumi.getter
    def status(self) -> Optional[str]:
        """
        The snapshot status. Value range: `progressing`, `accomplished` and `failed`.
        """
        return pulumi.get(self, "status")

    @property
    @pulumi.getter
    def tags(self) -> Optional[Mapping[str, Any]]:
        """
        A map of tags assigned to the snapshot.
        """
        return pulumi.get(self, "tags")

    @property
    @pulumi.getter
    def type(self) -> Optional[str]:
        return pulumi.get(self, "type")

    @property
    @pulumi.getter
    def usage(self) -> Optional[str]:
        """
        Whether the snapshots are used to create resources or not. Value range: `image`, `disk`, `image_disk` and `none`.
        """
        return pulumi.get(self, "usage")


class AwaitableGetSnapshotsResult(GetSnapshotsResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetSnapshotsResult(
            disk_id=self.disk_id,
            encrypted=self.encrypted,
            id=self.id,
            ids=self.ids,
            instance_id=self.instance_id,
            name_regex=self.name_regex,
            names=self.names,
            output_file=self.output_file,
            snapshots=self.snapshots,
            source_disk_type=self.source_disk_type,
            status=self.status,
            tags=self.tags,
            type=self.type,
            usage=self.usage)


def get_snapshots(disk_id: Optional[str] = None,
                  encrypted: Optional[bool] = None,
                  ids: Optional[Sequence[str]] = None,
                  instance_id: Optional[str] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  source_disk_type: Optional[str] = None,
                  status: Optional[str] = None,
                  tags: Optional[Mapping[str, Any]] = None,
                  type: Optional[str] = None,
                  usage: Optional[str] = None,
                  opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetSnapshotsResult:
    """
    Use this data source to get a list of snapshot according to the specified filters in an Alibaba Cloud account.

    For information about snapshot and how to use it, see [Snapshot](https://www.alibabacloud.com/help/doc-detail/25460.html).

    > **NOTE:**  Available in 1.40.0+.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_alicloud as alicloud

    snapshots = alicloud.ecs.get_snapshots(ids=["s-123456890abcdef"],
        name_regex="tf-testAcc-snapshot")
    ```
    ## Argument Reference

    The following arguments are supported:

    * `instance_id` - (Optional) The specified instance ID.
    * `disk_id` - (Optional) The specified disk ID.
    * `encrypted` - (Optional) Queries the encrypted snapshots. Optional values: `true`: Encrypted snapshots. `false`: No encryption attribute limit. Default value: `false`.
    * `ids` - (Optional)  A list of snapshot IDs.
    * `name_regex` - (Optional) A regex string to filter results by snapshot name.
    * `status` - (Optional) The specified snapshot status. Default value: `all`. Optional values:
      * progressing: The snapshots are being created.
      * accomplished: The snapshots are ready to use.
      * failed: The snapshot creation failed.
      * all: All status.
    * `type` - (Optional) The snapshot category. Default value: `all`. Optional values:
      * auto: Auto snapshots.
      * user: Manual snapshots.
      * all: Auto and manual snapshots.
    * `source_disk_type` - (Optional) The type of source disk:
      * System: The snapshots are created for system disks.
      * Data: The snapshots are created for data disks.
    * `usage` - (Optional) The usage of the snapshot:
      * image: The snapshots are used to create custom images.
      * disk: The snapshots are used to CreateDisk.
      * mage_disk: The snapshots are used to create custom images and data disks.
      * none: The snapshots are not used yet.
    * `tags` - (Optional) A map of tags assigned to snapshots.
    * `output_file` - (Optional) The name of output file that saves the filter results.


    :param bool encrypted: Whether the snapshot is encrypted or not.
    :param Sequence[str] ids: A list of snapshot IDs.
    :param str source_disk_type: Source disk attribute. Value range: `System`,`Data`.
    :param str status: The snapshot status. Value range: `progressing`, `accomplished` and `failed`.
    :param Mapping[str, Any] tags: A map of tags assigned to the snapshot.
    :param str usage: Whether the snapshots are used to create resources or not. Value range: `image`, `disk`, `image_disk` and `none`.
    """
    __args__ = dict()
    __args__['diskId'] = disk_id
    __args__['encrypted'] = encrypted
    __args__['ids'] = ids
    __args__['instanceId'] = instance_id
    __args__['nameRegex'] = name_regex
    __args__['outputFile'] = output_file
    __args__['sourceDiskType'] = source_disk_type
    __args__['status'] = status
    __args__['tags'] = tags
    __args__['type'] = type
    __args__['usage'] = usage
    if opts is None:
        opts = pulumi.InvokeOptions()
    if opts.version is None:
        opts.version = _utilities.get_version()
    __ret__ = pulumi.runtime.invoke('alicloud:ecs/getSnapshots:getSnapshots', __args__, opts=opts, typ=GetSnapshotsResult).value

    return AwaitableGetSnapshotsResult(
        disk_id=__ret__.disk_id,
        encrypted=__ret__.encrypted,
        id=__ret__.id,
        ids=__ret__.ids,
        instance_id=__ret__.instance_id,
        name_regex=__ret__.name_regex,
        names=__ret__.names,
        output_file=__ret__.output_file,
        snapshots=__ret__.snapshots,
        source_disk_type=__ret__.source_disk_type,
        status=__ret__.status,
        tags=__ret__.tags,
        type=__ret__.type,
        usage=__ret__.usage)
