# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from .. import _utilities
from . import outputs

__all__ = [
    'GetInstancePolicyResult',
    'AwaitableGetInstancePolicyResult',
    'get_instance_policy',
    'get_instance_policy_output',
]

@pulumi.output_type
class GetInstancePolicyResult:
    """
    A collection of values returned by getInstancePolicy.
    """
    def __init__(__self__, action=None, id=None, instance_group_id=None, instance_policy_id=None, metrics=None, name=None, priority=None, project_id=None, type=None, value=None, zone=None):
        if action and not isinstance(action, str):
            raise TypeError("Expected argument 'action' to be a str")
        pulumi.set(__self__, "action", action)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if instance_group_id and not isinstance(instance_group_id, str):
            raise TypeError("Expected argument 'instance_group_id' to be a str")
        pulumi.set(__self__, "instance_group_id", instance_group_id)
        if instance_policy_id and not isinstance(instance_policy_id, str):
            raise TypeError("Expected argument 'instance_policy_id' to be a str")
        pulumi.set(__self__, "instance_policy_id", instance_policy_id)
        if metrics and not isinstance(metrics, list):
            raise TypeError("Expected argument 'metrics' to be a list")
        pulumi.set(__self__, "metrics", metrics)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if priority and not isinstance(priority, int):
            raise TypeError("Expected argument 'priority' to be a int")
        pulumi.set(__self__, "priority", priority)
        if project_id and not isinstance(project_id, str):
            raise TypeError("Expected argument 'project_id' to be a str")
        pulumi.set(__self__, "project_id", project_id)
        if type and not isinstance(type, str):
            raise TypeError("Expected argument 'type' to be a str")
        pulumi.set(__self__, "type", type)
        if value and not isinstance(value, int):
            raise TypeError("Expected argument 'value' to be a int")
        pulumi.set(__self__, "value", value)
        if zone and not isinstance(zone, str):
            raise TypeError("Expected argument 'zone' to be a str")
        pulumi.set(__self__, "zone", zone)

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

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

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

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

    @_builtins.property
    @pulumi.getter
    def metrics(self) -> Sequence['outputs.GetInstancePolicyMetricResult']:
        return pulumi.get(self, "metrics")

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

    @_builtins.property
    @pulumi.getter
    def priority(self) -> _builtins.int:
        return pulumi.get(self, "priority")

    @_builtins.property
    @pulumi.getter(name="projectId")
    def project_id(self) -> _builtins.str:
        return pulumi.get(self, "project_id")

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

    @_builtins.property
    @pulumi.getter
    def value(self) -> _builtins.int:
        return pulumi.get(self, "value")

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


class AwaitableGetInstancePolicyResult(GetInstancePolicyResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetInstancePolicyResult(
            action=self.action,
            id=self.id,
            instance_group_id=self.instance_group_id,
            instance_policy_id=self.instance_policy_id,
            metrics=self.metrics,
            name=self.name,
            priority=self.priority,
            project_id=self.project_id,
            type=self.type,
            value=self.value,
            zone=self.zone)


def get_instance_policy(instance_group_id: Optional[_builtins.str] = None,
                        instance_policy_id: Optional[_builtins.str] = None,
                        name: Optional[_builtins.str] = None,
                        zone: Optional[_builtins.str] = None,
                        opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetInstancePolicyResult:
    """
    Gets information about an Autoscaling Instance policy.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Get info by name (instance_group_id is required when using name)
    by_name = scaleway.autoscaling.get_instance_policy(name="my-instance-policy",
        instance_group_id=main["id"])
    # Get info by ID
    by_id = scaleway.autoscaling.get_instance_policy(instance_policy_id="11111111-1111-1111-1111-111111111111")
    ```


    :param _builtins.str instance_group_id: The ID of the Instance group the policy belongs to. Required when looking up by `name`.
    :param _builtins.str instance_policy_id: The ID of the Instance policy. Only one of `name` and `instance_policy_id` should be specified.
    :param _builtins.str name: The name of the Instance policy. Only one of `name` and `instance_policy_id` should be specified. When using `name`, `instance_group_id` is required.
    :param _builtins.str zone: `zone`) The zone in which the Instance policy exists.
    """
    __args__ = dict()
    __args__['instanceGroupId'] = instance_group_id
    __args__['instancePolicyId'] = instance_policy_id
    __args__['name'] = name
    __args__['zone'] = zone
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('scaleway:autoscaling/getInstancePolicy:getInstancePolicy', __args__, opts=opts, typ=GetInstancePolicyResult).value

    return AwaitableGetInstancePolicyResult(
        action=pulumi.get(__ret__, 'action'),
        id=pulumi.get(__ret__, 'id'),
        instance_group_id=pulumi.get(__ret__, 'instance_group_id'),
        instance_policy_id=pulumi.get(__ret__, 'instance_policy_id'),
        metrics=pulumi.get(__ret__, 'metrics'),
        name=pulumi.get(__ret__, 'name'),
        priority=pulumi.get(__ret__, 'priority'),
        project_id=pulumi.get(__ret__, 'project_id'),
        type=pulumi.get(__ret__, 'type'),
        value=pulumi.get(__ret__, 'value'),
        zone=pulumi.get(__ret__, 'zone'))
def get_instance_policy_output(instance_group_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                               instance_policy_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                               name: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                               zone: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                               opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetInstancePolicyResult]:
    """
    Gets information about an Autoscaling Instance policy.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Get info by name (instance_group_id is required when using name)
    by_name = scaleway.autoscaling.get_instance_policy(name="my-instance-policy",
        instance_group_id=main["id"])
    # Get info by ID
    by_id = scaleway.autoscaling.get_instance_policy(instance_policy_id="11111111-1111-1111-1111-111111111111")
    ```


    :param _builtins.str instance_group_id: The ID of the Instance group the policy belongs to. Required when looking up by `name`.
    :param _builtins.str instance_policy_id: The ID of the Instance policy. Only one of `name` and `instance_policy_id` should be specified.
    :param _builtins.str name: The name of the Instance policy. Only one of `name` and `instance_policy_id` should be specified. When using `name`, `instance_group_id` is required.
    :param _builtins.str zone: `zone`) The zone in which the Instance policy exists.
    """
    __args__ = dict()
    __args__['instanceGroupId'] = instance_group_id
    __args__['instancePolicyId'] = instance_policy_id
    __args__['name'] = name
    __args__['zone'] = zone
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('scaleway:autoscaling/getInstancePolicy:getInstancePolicy', __args__, opts=opts, typ=GetInstancePolicyResult)
    return __ret__.apply(lambda __response__: GetInstancePolicyResult(
        action=pulumi.get(__response__, 'action'),
        id=pulumi.get(__response__, 'id'),
        instance_group_id=pulumi.get(__response__, 'instance_group_id'),
        instance_policy_id=pulumi.get(__response__, 'instance_policy_id'),
        metrics=pulumi.get(__response__, 'metrics'),
        name=pulumi.get(__response__, 'name'),
        priority=pulumi.get(__response__, 'priority'),
        project_id=pulumi.get(__response__, 'project_id'),
        type=pulumi.get(__response__, 'type'),
        value=pulumi.get(__response__, 'value'),
        zone=pulumi.get(__response__, 'zone')))
