# 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, Dict, List, Mapping, Optional, Tuple, Union
from .. import _utilities, _tables
from . import outputs
from ._inputs import *

__all__ = ['KubernetesAutoscaler']


class KubernetesAutoscaler(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 cluster_id: Optional[pulumi.Input[str]] = None,
                 cool_down_duration: Optional[pulumi.Input[str]] = None,
                 defer_scale_in_duration: Optional[pulumi.Input[str]] = None,
                 nodepools: Optional[pulumi.Input[List[pulumi.Input[pulumi.InputType['KubernetesAutoscalerNodepoolArgs']]]]] = None,
                 use_ecs_ram_role_token: Optional[pulumi.Input[bool]] = None,
                 utilization: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        This resource will help you to manager cluster-autoscaler in Kubernetes Cluster.

        > **NOTE:** The scaling group must use CentOS7 or AliyunLinux2 as base image.

        > **NOTE:** The cluster-autoscaler can only use the same size of instanceTypes in one scaling group.

        > **NOTE:** Add Policy to RAM role of the node to deploy cluster-autoscaler if you need.

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

        ## Example Usage

        cluster-autoscaler in Kubernetes Cluster

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        default = alicloud.cs.KubernetesAutoscaler("default",
            cluster_id=var["cluster_id"],
            nodepools=[alicloud.cs.KubernetesAutoscalerNodepoolArgs(
                id="scaling_group_id",
                taints="c=d:NoSchedule",
                labels="a=b",
            )],
            utilization=var["utilization"],
            cool_down_duration=var["cool_down_duration"],
            defer_scale_in_duration=var["defer_scale_in_duration"])
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] cluster_id: The id of kubernetes cluster.
        :param pulumi.Input[str] cool_down_duration: The cool_down_duration option of cluster-autoscaler.
        :param pulumi.Input[str] defer_scale_in_duration: The defer_scale_in_duration option of cluster-autoscaler.
        :param pulumi.Input[List[pulumi.Input[pulumi.InputType['KubernetesAutoscalerNodepoolArgs']]]] nodepools: * `nodepools.id` - (Required) The scaling group id of the groups configured for cluster-autoscaler.
               * `nodepools.taints` - (Required) The taints for the nodes in scaling group.
               * `nodepools.labels` - (Required) The labels for the nodes in scaling group.
        :param pulumi.Input[bool] use_ecs_ram_role_token: Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
        :param pulumi.Input[str] utilization: The utilization option of cluster-autoscaler.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = dict()

            if cluster_id is None:
                raise TypeError("Missing required property 'cluster_id'")
            __props__['cluster_id'] = cluster_id
            if cool_down_duration is None:
                raise TypeError("Missing required property 'cool_down_duration'")
            __props__['cool_down_duration'] = cool_down_duration
            if defer_scale_in_duration is None:
                raise TypeError("Missing required property 'defer_scale_in_duration'")
            __props__['defer_scale_in_duration'] = defer_scale_in_duration
            __props__['nodepools'] = nodepools
            __props__['use_ecs_ram_role_token'] = use_ecs_ram_role_token
            if utilization is None:
                raise TypeError("Missing required property 'utilization'")
            __props__['utilization'] = utilization
        super(KubernetesAutoscaler, __self__).__init__(
            'alicloud:cs/kubernetesAutoscaler:KubernetesAutoscaler',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            cluster_id: Optional[pulumi.Input[str]] = None,
            cool_down_duration: Optional[pulumi.Input[str]] = None,
            defer_scale_in_duration: Optional[pulumi.Input[str]] = None,
            nodepools: Optional[pulumi.Input[List[pulumi.Input[pulumi.InputType['KubernetesAutoscalerNodepoolArgs']]]]] = None,
            use_ecs_ram_role_token: Optional[pulumi.Input[bool]] = None,
            utilization: Optional[pulumi.Input[str]] = None) -> 'KubernetesAutoscaler':
        """
        Get an existing KubernetesAutoscaler resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] cluster_id: The id of kubernetes cluster.
        :param pulumi.Input[str] cool_down_duration: The cool_down_duration option of cluster-autoscaler.
        :param pulumi.Input[str] defer_scale_in_duration: The defer_scale_in_duration option of cluster-autoscaler.
        :param pulumi.Input[List[pulumi.Input[pulumi.InputType['KubernetesAutoscalerNodepoolArgs']]]] nodepools: * `nodepools.id` - (Required) The scaling group id of the groups configured for cluster-autoscaler.
               * `nodepools.taints` - (Required) The taints for the nodes in scaling group.
               * `nodepools.labels` - (Required) The labels for the nodes in scaling group.
        :param pulumi.Input[bool] use_ecs_ram_role_token: Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
        :param pulumi.Input[str] utilization: The utilization option of cluster-autoscaler.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["cluster_id"] = cluster_id
        __props__["cool_down_duration"] = cool_down_duration
        __props__["defer_scale_in_duration"] = defer_scale_in_duration
        __props__["nodepools"] = nodepools
        __props__["use_ecs_ram_role_token"] = use_ecs_ram_role_token
        __props__["utilization"] = utilization
        return KubernetesAutoscaler(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="clusterId")
    def cluster_id(self) -> pulumi.Output[str]:
        """
        The id of kubernetes cluster.
        """
        return pulumi.get(self, "cluster_id")

    @property
    @pulumi.getter(name="coolDownDuration")
    def cool_down_duration(self) -> pulumi.Output[str]:
        """
        The cool_down_duration option of cluster-autoscaler.
        """
        return pulumi.get(self, "cool_down_duration")

    @property
    @pulumi.getter(name="deferScaleInDuration")
    def defer_scale_in_duration(self) -> pulumi.Output[str]:
        """
        The defer_scale_in_duration option of cluster-autoscaler.
        """
        return pulumi.get(self, "defer_scale_in_duration")

    @property
    @pulumi.getter
    def nodepools(self) -> pulumi.Output[Optional[List['outputs.KubernetesAutoscalerNodepool']]]:
        """
        * `nodepools.id` - (Required) The scaling group id of the groups configured for cluster-autoscaler.
        * `nodepools.taints` - (Required) The taints for the nodes in scaling group.
        * `nodepools.labels` - (Required) The labels for the nodes in scaling group.
        """
        return pulumi.get(self, "nodepools")

    @property
    @pulumi.getter(name="useEcsRamRoleToken")
    def use_ecs_ram_role_token(self) -> pulumi.Output[Optional[bool]]:
        """
        Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
        """
        return pulumi.get(self, "use_ecs_ram_role_token")

    @property
    @pulumi.getter
    def utilization(self) -> pulumi.Output[str]:
        """
        The utilization option of cluster-autoscaler.
        """
        return pulumi.get(self, "utilization")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

