# 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 copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities

__all__ = [
    'GetImageResult',
    'AwaitableGetImageResult',
    'get_image',
    'get_image_output',
]

@pulumi.output_type
class GetImageResult:
    """
    A collection of values returned by getImage.
    """
    def __init__(__self__, description=None, external_id=None, filter=None, id=None, name=None, private=None, region=None):
        if description and not isinstance(description, str):
            raise TypeError("Expected argument 'description' to be a str")
        pulumi.set(__self__, "description", description)
        if external_id and not isinstance(external_id, str):
            raise TypeError("Expected argument 'external_id' to be a str")
        pulumi.set(__self__, "external_id", external_id)
        if filter and not isinstance(filter, str):
            raise TypeError("Expected argument 'filter' to be a str")
        pulumi.set(__self__, "filter", filter)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if private and not isinstance(private, bool):
            raise TypeError("Expected argument 'private' to be a bool")
        pulumi.set(__self__, "private", private)
        if region and not isinstance(region, str):
            raise TypeError("Expected argument 'region' to be a str")
        pulumi.set(__self__, "region", region)

    @property
    @pulumi.getter
    def description(self) -> str:
        """
        A human-friendly description of the image.
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter(name="externalId")
    def external_id(self) -> str:
        """
        External entity id on the provider side.
        """
        return pulumi.get(self, "external_id")

    @property
    @pulumi.getter
    def filter(self) -> str:
        return pulumi.get(self, "filter")

    @property
    @pulumi.getter
    def id(self) -> str:
        """
        The id of the image.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter
    def name(self) -> str:
        """
        A human-friendly name used as an identifier in APIs that support this option.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter
    def private(self) -> bool:
        """
        Indicates whether this image is private. For vSphere, private images are templates and snapshots and public images are content library items.
        """
        return pulumi.get(self, "private")

    @property
    @pulumi.getter
    def region(self) -> str:
        """
        The regionId of the image. For a vSphere cloud account, it is the `externalRegionId` such as `Datacenter:datacenter-2` and for an AWS cloud account, it is region name such as `us-east-1`, etc.
        """
        return pulumi.get(self, "region")


class AwaitableGetImageResult(GetImageResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetImageResult(
            description=self.description,
            external_id=self.external_id,
            filter=self.filter,
            id=self.id,
            name=self.name,
            private=self.private,
            region=self.region)


def get_image(filter: Optional[str] = None,
              opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetImageResult:
    """
    The `image.get_image` data source can be used to discover the lookup machine images with cloud accounts. This can then be used with resource that require an image. For example, to create an image profile using the `image.Profile` resource.

    ## Example Usage

    This is an example of how to lookup images from a vSphere cloud account.

    ```python
    import pulumi
    import pulumi_vra as vra
    import pulumiverse_vra as vra

    this_v_sphere = vra.cloudaccount.get_v_sphere(name=var["cloud_account"])
    this_region = vra.region.get_region(cloud_account_id=this_v_sphere.id,
        region=var["region"])
    image0 = vra.image.get_image(filter=f"name eq '{var['image_name_0']}' and cloudAccountId eq '{this_v_sphere.id}' and externalRegionId eq '{var['region']}'")
    image1 = vra.image.get_image(filter=f"name eq '{var['image_name_1']}' and cloudAccountId eq '{this_v_sphere.id}' and externalRegionId eq '{var['region']}'")
    this_profile = vra.image.Profile("thisProfile",
        description=var["image_profile_description"],
        region_id=this_region.id,
        image_mappings=[
            vra.image.ProfileImageMappingArgs(
                name=var["image_name_0"],
                image_id=image0.id,
            ),
            vra.image.ProfileImageMappingArgs(
                name=var["image_name_1"],
                image_id=image1.id,
            ),
        ])
    ```


    :param str filter: Search criteria to narrow down the image discovery.
    """
    __args__ = dict()
    __args__['filter'] = filter
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('vra:image/getImage:getImage', __args__, opts=opts, typ=GetImageResult).value

    return AwaitableGetImageResult(
        description=__ret__.description,
        external_id=__ret__.external_id,
        filter=__ret__.filter,
        id=__ret__.id,
        name=__ret__.name,
        private=__ret__.private,
        region=__ret__.region)


@_utilities.lift_output_func(get_image)
def get_image_output(filter: Optional[pulumi.Input[str]] = None,
                     opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetImageResult]:
    """
    The `image.get_image` data source can be used to discover the lookup machine images with cloud accounts. This can then be used with resource that require an image. For example, to create an image profile using the `image.Profile` resource.

    ## Example Usage

    This is an example of how to lookup images from a vSphere cloud account.

    ```python
    import pulumi
    import pulumi_vra as vra
    import pulumiverse_vra as vra

    this_v_sphere = vra.cloudaccount.get_v_sphere(name=var["cloud_account"])
    this_region = vra.region.get_region(cloud_account_id=this_v_sphere.id,
        region=var["region"])
    image0 = vra.image.get_image(filter=f"name eq '{var['image_name_0']}' and cloudAccountId eq '{this_v_sphere.id}' and externalRegionId eq '{var['region']}'")
    image1 = vra.image.get_image(filter=f"name eq '{var['image_name_1']}' and cloudAccountId eq '{this_v_sphere.id}' and externalRegionId eq '{var['region']}'")
    this_profile = vra.image.Profile("thisProfile",
        description=var["image_profile_description"],
        region_id=this_region.id,
        image_mappings=[
            vra.image.ProfileImageMappingArgs(
                name=var["image_name_0"],
                image_id=image0.id,
            ),
            vra.image.ProfileImageMappingArgs(
                name=var["image_name_1"],
                image_id=image1.id,
            ),
        ])
    ```


    :param str filter: Search criteria to narrow down the image discovery.
    """
    ...
