# 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
from . import outputs
from ._inputs import *

__all__ = ['ApplicationScalingRuleArgs', 'ApplicationScalingRule']

@pulumi.input_type
class ApplicationScalingRuleArgs:
    def __init__(__self__, *,
                 app_id: pulumi.Input[str],
                 scaling_rule_name: pulumi.Input[str],
                 scaling_rule_type: pulumi.Input[str],
                 min_ready_instance_ratio: Optional[pulumi.Input[int]] = None,
                 min_ready_instances: Optional[pulumi.Input[int]] = None,
                 scaling_rule_enable: Optional[pulumi.Input[bool]] = None,
                 scaling_rule_metric: Optional[pulumi.Input['ApplicationScalingRuleScalingRuleMetricArgs']] = None,
                 scaling_rule_timer: Optional[pulumi.Input['ApplicationScalingRuleScalingRuleTimerArgs']] = None):
        """
        The set of arguments for constructing a ApplicationScalingRule resource.
        :param pulumi.Input[str] app_id: Application ID.
        :param pulumi.Input[str] scaling_rule_name: The name of a custom elastic scaling policy. In the application, the policy name cannot be repeated. It must start with a lowercase letter, and can only contain lowercase letters, numbers, and dashes (-), and no more than 32 characters. After the scaling policy is successfully created, the policy name cannot be modified.
        :param pulumi.Input[str] scaling_rule_type: Flexible strategy type. Valid values: `mix`, `timing` and `metric`.
        :param pulumi.Input[int] min_ready_instance_ratio: The min ready instance ratio.
        :param pulumi.Input[int] min_ready_instances: The min ready instances.
        :param pulumi.Input[bool] scaling_rule_enable: True whether the auto scaling policy is enabled. The value description is as follows: true: enabled state. false: disabled status. Valid values: `false`, `true`.
        :param pulumi.Input['ApplicationScalingRuleScalingRuleMetricArgs'] scaling_rule_metric: Monitor the configuration of the indicator elasticity strategy. See the following `Block scaling_rule_metric`.
        :param pulumi.Input['ApplicationScalingRuleScalingRuleTimerArgs'] scaling_rule_timer: Configuration of Timing Resilient Policies. See the following `Block scaling_rule_timer`.
        """
        pulumi.set(__self__, "app_id", app_id)
        pulumi.set(__self__, "scaling_rule_name", scaling_rule_name)
        pulumi.set(__self__, "scaling_rule_type", scaling_rule_type)
        if min_ready_instance_ratio is not None:
            pulumi.set(__self__, "min_ready_instance_ratio", min_ready_instance_ratio)
        if min_ready_instances is not None:
            pulumi.set(__self__, "min_ready_instances", min_ready_instances)
        if scaling_rule_enable is not None:
            pulumi.set(__self__, "scaling_rule_enable", scaling_rule_enable)
        if scaling_rule_metric is not None:
            pulumi.set(__self__, "scaling_rule_metric", scaling_rule_metric)
        if scaling_rule_timer is not None:
            pulumi.set(__self__, "scaling_rule_timer", scaling_rule_timer)

    @property
    @pulumi.getter(name="appId")
    def app_id(self) -> pulumi.Input[str]:
        """
        Application ID.
        """
        return pulumi.get(self, "app_id")

    @app_id.setter
    def app_id(self, value: pulumi.Input[str]):
        pulumi.set(self, "app_id", value)

    @property
    @pulumi.getter(name="scalingRuleName")
    def scaling_rule_name(self) -> pulumi.Input[str]:
        """
        The name of a custom elastic scaling policy. In the application, the policy name cannot be repeated. It must start with a lowercase letter, and can only contain lowercase letters, numbers, and dashes (-), and no more than 32 characters. After the scaling policy is successfully created, the policy name cannot be modified.
        """
        return pulumi.get(self, "scaling_rule_name")

    @scaling_rule_name.setter
    def scaling_rule_name(self, value: pulumi.Input[str]):
        pulumi.set(self, "scaling_rule_name", value)

    @property
    @pulumi.getter(name="scalingRuleType")
    def scaling_rule_type(self) -> pulumi.Input[str]:
        """
        Flexible strategy type. Valid values: `mix`, `timing` and `metric`.
        """
        return pulumi.get(self, "scaling_rule_type")

    @scaling_rule_type.setter
    def scaling_rule_type(self, value: pulumi.Input[str]):
        pulumi.set(self, "scaling_rule_type", value)

    @property
    @pulumi.getter(name="minReadyInstanceRatio")
    def min_ready_instance_ratio(self) -> Optional[pulumi.Input[int]]:
        """
        The min ready instance ratio.
        """
        return pulumi.get(self, "min_ready_instance_ratio")

    @min_ready_instance_ratio.setter
    def min_ready_instance_ratio(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "min_ready_instance_ratio", value)

    @property
    @pulumi.getter(name="minReadyInstances")
    def min_ready_instances(self) -> Optional[pulumi.Input[int]]:
        """
        The min ready instances.
        """
        return pulumi.get(self, "min_ready_instances")

    @min_ready_instances.setter
    def min_ready_instances(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "min_ready_instances", value)

    @property
    @pulumi.getter(name="scalingRuleEnable")
    def scaling_rule_enable(self) -> Optional[pulumi.Input[bool]]:
        """
        True whether the auto scaling policy is enabled. The value description is as follows: true: enabled state. false: disabled status. Valid values: `false`, `true`.
        """
        return pulumi.get(self, "scaling_rule_enable")

    @scaling_rule_enable.setter
    def scaling_rule_enable(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "scaling_rule_enable", value)

    @property
    @pulumi.getter(name="scalingRuleMetric")
    def scaling_rule_metric(self) -> Optional[pulumi.Input['ApplicationScalingRuleScalingRuleMetricArgs']]:
        """
        Monitor the configuration of the indicator elasticity strategy. See the following `Block scaling_rule_metric`.
        """
        return pulumi.get(self, "scaling_rule_metric")

    @scaling_rule_metric.setter
    def scaling_rule_metric(self, value: Optional[pulumi.Input['ApplicationScalingRuleScalingRuleMetricArgs']]):
        pulumi.set(self, "scaling_rule_metric", value)

    @property
    @pulumi.getter(name="scalingRuleTimer")
    def scaling_rule_timer(self) -> Optional[pulumi.Input['ApplicationScalingRuleScalingRuleTimerArgs']]:
        """
        Configuration of Timing Resilient Policies. See the following `Block scaling_rule_timer`.
        """
        return pulumi.get(self, "scaling_rule_timer")

    @scaling_rule_timer.setter
    def scaling_rule_timer(self, value: Optional[pulumi.Input['ApplicationScalingRuleScalingRuleTimerArgs']]):
        pulumi.set(self, "scaling_rule_timer", value)


@pulumi.input_type
class _ApplicationScalingRuleState:
    def __init__(__self__, *,
                 app_id: Optional[pulumi.Input[str]] = None,
                 min_ready_instance_ratio: Optional[pulumi.Input[int]] = None,
                 min_ready_instances: Optional[pulumi.Input[int]] = None,
                 scaling_rule_enable: Optional[pulumi.Input[bool]] = None,
                 scaling_rule_metric: Optional[pulumi.Input['ApplicationScalingRuleScalingRuleMetricArgs']] = None,
                 scaling_rule_name: Optional[pulumi.Input[str]] = None,
                 scaling_rule_timer: Optional[pulumi.Input['ApplicationScalingRuleScalingRuleTimerArgs']] = None,
                 scaling_rule_type: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering ApplicationScalingRule resources.
        :param pulumi.Input[str] app_id: Application ID.
        :param pulumi.Input[int] min_ready_instance_ratio: The min ready instance ratio.
        :param pulumi.Input[int] min_ready_instances: The min ready instances.
        :param pulumi.Input[bool] scaling_rule_enable: True whether the auto scaling policy is enabled. The value description is as follows: true: enabled state. false: disabled status. Valid values: `false`, `true`.
        :param pulumi.Input['ApplicationScalingRuleScalingRuleMetricArgs'] scaling_rule_metric: Monitor the configuration of the indicator elasticity strategy. See the following `Block scaling_rule_metric`.
        :param pulumi.Input[str] scaling_rule_name: The name of a custom elastic scaling policy. In the application, the policy name cannot be repeated. It must start with a lowercase letter, and can only contain lowercase letters, numbers, and dashes (-), and no more than 32 characters. After the scaling policy is successfully created, the policy name cannot be modified.
        :param pulumi.Input['ApplicationScalingRuleScalingRuleTimerArgs'] scaling_rule_timer: Configuration of Timing Resilient Policies. See the following `Block scaling_rule_timer`.
        :param pulumi.Input[str] scaling_rule_type: Flexible strategy type. Valid values: `mix`, `timing` and `metric`.
        """
        if app_id is not None:
            pulumi.set(__self__, "app_id", app_id)
        if min_ready_instance_ratio is not None:
            pulumi.set(__self__, "min_ready_instance_ratio", min_ready_instance_ratio)
        if min_ready_instances is not None:
            pulumi.set(__self__, "min_ready_instances", min_ready_instances)
        if scaling_rule_enable is not None:
            pulumi.set(__self__, "scaling_rule_enable", scaling_rule_enable)
        if scaling_rule_metric is not None:
            pulumi.set(__self__, "scaling_rule_metric", scaling_rule_metric)
        if scaling_rule_name is not None:
            pulumi.set(__self__, "scaling_rule_name", scaling_rule_name)
        if scaling_rule_timer is not None:
            pulumi.set(__self__, "scaling_rule_timer", scaling_rule_timer)
        if scaling_rule_type is not None:
            pulumi.set(__self__, "scaling_rule_type", scaling_rule_type)

    @property
    @pulumi.getter(name="appId")
    def app_id(self) -> Optional[pulumi.Input[str]]:
        """
        Application ID.
        """
        return pulumi.get(self, "app_id")

    @app_id.setter
    def app_id(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "app_id", value)

    @property
    @pulumi.getter(name="minReadyInstanceRatio")
    def min_ready_instance_ratio(self) -> Optional[pulumi.Input[int]]:
        """
        The min ready instance ratio.
        """
        return pulumi.get(self, "min_ready_instance_ratio")

    @min_ready_instance_ratio.setter
    def min_ready_instance_ratio(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "min_ready_instance_ratio", value)

    @property
    @pulumi.getter(name="minReadyInstances")
    def min_ready_instances(self) -> Optional[pulumi.Input[int]]:
        """
        The min ready instances.
        """
        return pulumi.get(self, "min_ready_instances")

    @min_ready_instances.setter
    def min_ready_instances(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "min_ready_instances", value)

    @property
    @pulumi.getter(name="scalingRuleEnable")
    def scaling_rule_enable(self) -> Optional[pulumi.Input[bool]]:
        """
        True whether the auto scaling policy is enabled. The value description is as follows: true: enabled state. false: disabled status. Valid values: `false`, `true`.
        """
        return pulumi.get(self, "scaling_rule_enable")

    @scaling_rule_enable.setter
    def scaling_rule_enable(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "scaling_rule_enable", value)

    @property
    @pulumi.getter(name="scalingRuleMetric")
    def scaling_rule_metric(self) -> Optional[pulumi.Input['ApplicationScalingRuleScalingRuleMetricArgs']]:
        """
        Monitor the configuration of the indicator elasticity strategy. See the following `Block scaling_rule_metric`.
        """
        return pulumi.get(self, "scaling_rule_metric")

    @scaling_rule_metric.setter
    def scaling_rule_metric(self, value: Optional[pulumi.Input['ApplicationScalingRuleScalingRuleMetricArgs']]):
        pulumi.set(self, "scaling_rule_metric", value)

    @property
    @pulumi.getter(name="scalingRuleName")
    def scaling_rule_name(self) -> Optional[pulumi.Input[str]]:
        """
        The name of a custom elastic scaling policy. In the application, the policy name cannot be repeated. It must start with a lowercase letter, and can only contain lowercase letters, numbers, and dashes (-), and no more than 32 characters. After the scaling policy is successfully created, the policy name cannot be modified.
        """
        return pulumi.get(self, "scaling_rule_name")

    @scaling_rule_name.setter
    def scaling_rule_name(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "scaling_rule_name", value)

    @property
    @pulumi.getter(name="scalingRuleTimer")
    def scaling_rule_timer(self) -> Optional[pulumi.Input['ApplicationScalingRuleScalingRuleTimerArgs']]:
        """
        Configuration of Timing Resilient Policies. See the following `Block scaling_rule_timer`.
        """
        return pulumi.get(self, "scaling_rule_timer")

    @scaling_rule_timer.setter
    def scaling_rule_timer(self, value: Optional[pulumi.Input['ApplicationScalingRuleScalingRuleTimerArgs']]):
        pulumi.set(self, "scaling_rule_timer", value)

    @property
    @pulumi.getter(name="scalingRuleType")
    def scaling_rule_type(self) -> Optional[pulumi.Input[str]]:
        """
        Flexible strategy type. Valid values: `mix`, `timing` and `metric`.
        """
        return pulumi.get(self, "scaling_rule_type")

    @scaling_rule_type.setter
    def scaling_rule_type(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "scaling_rule_type", value)


class ApplicationScalingRule(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 app_id: Optional[pulumi.Input[str]] = None,
                 min_ready_instance_ratio: Optional[pulumi.Input[int]] = None,
                 min_ready_instances: Optional[pulumi.Input[int]] = None,
                 scaling_rule_enable: Optional[pulumi.Input[bool]] = None,
                 scaling_rule_metric: Optional[pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleMetricArgs']]] = None,
                 scaling_rule_name: Optional[pulumi.Input[str]] = None,
                 scaling_rule_timer: Optional[pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleTimerArgs']]] = None,
                 scaling_rule_type: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Provides a Serverless App Engine (SAE) Application Scaling Rule resource.

        For information about Serverless App Engine (SAE) Application Scaling Rule and how to use it, see [What is Application Scaling Rule](https://help.aliyun.com/document_detail/134120.html).

        > **NOTE:** Available in v1.159.0+.

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        default_networks = alicloud.vpc.get_networks(name_regex="default-NODELETING")
        default_switches = alicloud.vpc.get_switches(vpc_id=default_networks.ids[0])
        default_namespace = alicloud.sae.Namespace("defaultNamespace",
            namespace_description="example_value",
            namespace_id="example_value",
            namespace_name="example_value")
        default_application = alicloud.sae.Application("defaultApplication",
            app_description="example_value",
            app_name="example_value",
            namespace_id=default_namespace.namespace_id,
            image_url="registry-vpc.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5",
            package_type="Image",
            jdk="Open JDK 8",
            vswitch_id=default_switches.ids[0],
            vpc_id=default_networks.ids[0],
            timezone="Asia/Shanghai",
            replicas=5,
            cpu=500,
            memory=2048)
        example = alicloud.sae.ApplicationScalingRule("example",
            app_id=default_application.id,
            scaling_rule_name="example-value",
            scaling_rule_enable=True,
            scaling_rule_type="mix",
            scaling_rule_timer=alicloud.sae.ApplicationScalingRuleScalingRuleTimerArgs(
                begin_date="2022-02-25",
                end_date="2022-03-25",
                period="* * *",
                schedules=[
                    alicloud.sae.ApplicationScalingRuleScalingRuleTimerScheduleArgs(
                        at_time="08:00",
                        max_replicas=10,
                        min_replicas=3,
                    ),
                    alicloud.sae.ApplicationScalingRuleScalingRuleTimerScheduleArgs(
                        at_time="20:00",
                        max_replicas=50,
                        min_replicas=3,
                    ),
                ],
            ),
            scaling_rule_metric=alicloud.sae.ApplicationScalingRuleScalingRuleMetricArgs(
                max_replicas=50,
                min_replicas=3,
                metrics=[
                    alicloud.sae.ApplicationScalingRuleScalingRuleMetricMetricArgs(
                        metric_type="CPU",
                        metric_target_average_utilization=20,
                    ),
                    alicloud.sae.ApplicationScalingRuleScalingRuleMetricMetricArgs(
                        metric_type="MEMORY",
                        metric_target_average_utilization=30,
                    ),
                    alicloud.sae.ApplicationScalingRuleScalingRuleMetricMetricArgs(
                        metric_type="tcpActiveConn",
                        metric_target_average_utilization=20,
                    ),
                ],
                scale_up_rules=alicloud.sae.ApplicationScalingRuleScalingRuleMetricScaleUpRulesArgs(
                    step=10,
                    disabled=False,
                    stabilization_window_seconds=0,
                ),
                scale_down_rules=alicloud.sae.ApplicationScalingRuleScalingRuleMetricScaleDownRulesArgs(
                    step=10,
                    disabled=False,
                    stabilization_window_seconds=10,
                ),
            ))
        ```

        ## Import

        Serverless App Engine (SAE) Application Scaling Rule can be imported using the id, e.g.

        ```sh
         $ pulumi import alicloud:sae/applicationScalingRule:ApplicationScalingRule example <app_id>:<scaling_rule_name>
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] app_id: Application ID.
        :param pulumi.Input[int] min_ready_instance_ratio: The min ready instance ratio.
        :param pulumi.Input[int] min_ready_instances: The min ready instances.
        :param pulumi.Input[bool] scaling_rule_enable: True whether the auto scaling policy is enabled. The value description is as follows: true: enabled state. false: disabled status. Valid values: `false`, `true`.
        :param pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleMetricArgs']] scaling_rule_metric: Monitor the configuration of the indicator elasticity strategy. See the following `Block scaling_rule_metric`.
        :param pulumi.Input[str] scaling_rule_name: The name of a custom elastic scaling policy. In the application, the policy name cannot be repeated. It must start with a lowercase letter, and can only contain lowercase letters, numbers, and dashes (-), and no more than 32 characters. After the scaling policy is successfully created, the policy name cannot be modified.
        :param pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleTimerArgs']] scaling_rule_timer: Configuration of Timing Resilient Policies. See the following `Block scaling_rule_timer`.
        :param pulumi.Input[str] scaling_rule_type: Flexible strategy type. Valid values: `mix`, `timing` and `metric`.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ApplicationScalingRuleArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Provides a Serverless App Engine (SAE) Application Scaling Rule resource.

        For information about Serverless App Engine (SAE) Application Scaling Rule and how to use it, see [What is Application Scaling Rule](https://help.aliyun.com/document_detail/134120.html).

        > **NOTE:** Available in v1.159.0+.

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        default_networks = alicloud.vpc.get_networks(name_regex="default-NODELETING")
        default_switches = alicloud.vpc.get_switches(vpc_id=default_networks.ids[0])
        default_namespace = alicloud.sae.Namespace("defaultNamespace",
            namespace_description="example_value",
            namespace_id="example_value",
            namespace_name="example_value")
        default_application = alicloud.sae.Application("defaultApplication",
            app_description="example_value",
            app_name="example_value",
            namespace_id=default_namespace.namespace_id,
            image_url="registry-vpc.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5",
            package_type="Image",
            jdk="Open JDK 8",
            vswitch_id=default_switches.ids[0],
            vpc_id=default_networks.ids[0],
            timezone="Asia/Shanghai",
            replicas=5,
            cpu=500,
            memory=2048)
        example = alicloud.sae.ApplicationScalingRule("example",
            app_id=default_application.id,
            scaling_rule_name="example-value",
            scaling_rule_enable=True,
            scaling_rule_type="mix",
            scaling_rule_timer=alicloud.sae.ApplicationScalingRuleScalingRuleTimerArgs(
                begin_date="2022-02-25",
                end_date="2022-03-25",
                period="* * *",
                schedules=[
                    alicloud.sae.ApplicationScalingRuleScalingRuleTimerScheduleArgs(
                        at_time="08:00",
                        max_replicas=10,
                        min_replicas=3,
                    ),
                    alicloud.sae.ApplicationScalingRuleScalingRuleTimerScheduleArgs(
                        at_time="20:00",
                        max_replicas=50,
                        min_replicas=3,
                    ),
                ],
            ),
            scaling_rule_metric=alicloud.sae.ApplicationScalingRuleScalingRuleMetricArgs(
                max_replicas=50,
                min_replicas=3,
                metrics=[
                    alicloud.sae.ApplicationScalingRuleScalingRuleMetricMetricArgs(
                        metric_type="CPU",
                        metric_target_average_utilization=20,
                    ),
                    alicloud.sae.ApplicationScalingRuleScalingRuleMetricMetricArgs(
                        metric_type="MEMORY",
                        metric_target_average_utilization=30,
                    ),
                    alicloud.sae.ApplicationScalingRuleScalingRuleMetricMetricArgs(
                        metric_type="tcpActiveConn",
                        metric_target_average_utilization=20,
                    ),
                ],
                scale_up_rules=alicloud.sae.ApplicationScalingRuleScalingRuleMetricScaleUpRulesArgs(
                    step=10,
                    disabled=False,
                    stabilization_window_seconds=0,
                ),
                scale_down_rules=alicloud.sae.ApplicationScalingRuleScalingRuleMetricScaleDownRulesArgs(
                    step=10,
                    disabled=False,
                    stabilization_window_seconds=10,
                ),
            ))
        ```

        ## Import

        Serverless App Engine (SAE) Application Scaling Rule can be imported using the id, e.g.

        ```sh
         $ pulumi import alicloud:sae/applicationScalingRule:ApplicationScalingRule example <app_id>:<scaling_rule_name>
        ```

        :param str resource_name: The name of the resource.
        :param ApplicationScalingRuleArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(ApplicationScalingRuleArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 app_id: Optional[pulumi.Input[str]] = None,
                 min_ready_instance_ratio: Optional[pulumi.Input[int]] = None,
                 min_ready_instances: Optional[pulumi.Input[int]] = None,
                 scaling_rule_enable: Optional[pulumi.Input[bool]] = None,
                 scaling_rule_metric: Optional[pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleMetricArgs']]] = None,
                 scaling_rule_name: Optional[pulumi.Input[str]] = None,
                 scaling_rule_timer: Optional[pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleTimerArgs']]] = None,
                 scaling_rule_type: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        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__ = ApplicationScalingRuleArgs.__new__(ApplicationScalingRuleArgs)

            if app_id is None and not opts.urn:
                raise TypeError("Missing required property 'app_id'")
            __props__.__dict__["app_id"] = app_id
            __props__.__dict__["min_ready_instance_ratio"] = min_ready_instance_ratio
            __props__.__dict__["min_ready_instances"] = min_ready_instances
            __props__.__dict__["scaling_rule_enable"] = scaling_rule_enable
            __props__.__dict__["scaling_rule_metric"] = scaling_rule_metric
            if scaling_rule_name is None and not opts.urn:
                raise TypeError("Missing required property 'scaling_rule_name'")
            __props__.__dict__["scaling_rule_name"] = scaling_rule_name
            __props__.__dict__["scaling_rule_timer"] = scaling_rule_timer
            if scaling_rule_type is None and not opts.urn:
                raise TypeError("Missing required property 'scaling_rule_type'")
            __props__.__dict__["scaling_rule_type"] = scaling_rule_type
        super(ApplicationScalingRule, __self__).__init__(
            'alicloud:sae/applicationScalingRule:ApplicationScalingRule',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            app_id: Optional[pulumi.Input[str]] = None,
            min_ready_instance_ratio: Optional[pulumi.Input[int]] = None,
            min_ready_instances: Optional[pulumi.Input[int]] = None,
            scaling_rule_enable: Optional[pulumi.Input[bool]] = None,
            scaling_rule_metric: Optional[pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleMetricArgs']]] = None,
            scaling_rule_name: Optional[pulumi.Input[str]] = None,
            scaling_rule_timer: Optional[pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleTimerArgs']]] = None,
            scaling_rule_type: Optional[pulumi.Input[str]] = None) -> 'ApplicationScalingRule':
        """
        Get an existing ApplicationScalingRule 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] app_id: Application ID.
        :param pulumi.Input[int] min_ready_instance_ratio: The min ready instance ratio.
        :param pulumi.Input[int] min_ready_instances: The min ready instances.
        :param pulumi.Input[bool] scaling_rule_enable: True whether the auto scaling policy is enabled. The value description is as follows: true: enabled state. false: disabled status. Valid values: `false`, `true`.
        :param pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleMetricArgs']] scaling_rule_metric: Monitor the configuration of the indicator elasticity strategy. See the following `Block scaling_rule_metric`.
        :param pulumi.Input[str] scaling_rule_name: The name of a custom elastic scaling policy. In the application, the policy name cannot be repeated. It must start with a lowercase letter, and can only contain lowercase letters, numbers, and dashes (-), and no more than 32 characters. After the scaling policy is successfully created, the policy name cannot be modified.
        :param pulumi.Input[pulumi.InputType['ApplicationScalingRuleScalingRuleTimerArgs']] scaling_rule_timer: Configuration of Timing Resilient Policies. See the following `Block scaling_rule_timer`.
        :param pulumi.Input[str] scaling_rule_type: Flexible strategy type. Valid values: `mix`, `timing` and `metric`.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ApplicationScalingRuleState.__new__(_ApplicationScalingRuleState)

        __props__.__dict__["app_id"] = app_id
        __props__.__dict__["min_ready_instance_ratio"] = min_ready_instance_ratio
        __props__.__dict__["min_ready_instances"] = min_ready_instances
        __props__.__dict__["scaling_rule_enable"] = scaling_rule_enable
        __props__.__dict__["scaling_rule_metric"] = scaling_rule_metric
        __props__.__dict__["scaling_rule_name"] = scaling_rule_name
        __props__.__dict__["scaling_rule_timer"] = scaling_rule_timer
        __props__.__dict__["scaling_rule_type"] = scaling_rule_type
        return ApplicationScalingRule(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="appId")
    def app_id(self) -> pulumi.Output[str]:
        """
        Application ID.
        """
        return pulumi.get(self, "app_id")

    @property
    @pulumi.getter(name="minReadyInstanceRatio")
    def min_ready_instance_ratio(self) -> pulumi.Output[Optional[int]]:
        """
        The min ready instance ratio.
        """
        return pulumi.get(self, "min_ready_instance_ratio")

    @property
    @pulumi.getter(name="minReadyInstances")
    def min_ready_instances(self) -> pulumi.Output[Optional[int]]:
        """
        The min ready instances.
        """
        return pulumi.get(self, "min_ready_instances")

    @property
    @pulumi.getter(name="scalingRuleEnable")
    def scaling_rule_enable(self) -> pulumi.Output[bool]:
        """
        True whether the auto scaling policy is enabled. The value description is as follows: true: enabled state. false: disabled status. Valid values: `false`, `true`.
        """
        return pulumi.get(self, "scaling_rule_enable")

    @property
    @pulumi.getter(name="scalingRuleMetric")
    def scaling_rule_metric(self) -> pulumi.Output[Optional['outputs.ApplicationScalingRuleScalingRuleMetric']]:
        """
        Monitor the configuration of the indicator elasticity strategy. See the following `Block scaling_rule_metric`.
        """
        return pulumi.get(self, "scaling_rule_metric")

    @property
    @pulumi.getter(name="scalingRuleName")
    def scaling_rule_name(self) -> pulumi.Output[str]:
        """
        The name of a custom elastic scaling policy. In the application, the policy name cannot be repeated. It must start with a lowercase letter, and can only contain lowercase letters, numbers, and dashes (-), and no more than 32 characters. After the scaling policy is successfully created, the policy name cannot be modified.
        """
        return pulumi.get(self, "scaling_rule_name")

    @property
    @pulumi.getter(name="scalingRuleTimer")
    def scaling_rule_timer(self) -> pulumi.Output[Optional['outputs.ApplicationScalingRuleScalingRuleTimer']]:
        """
        Configuration of Timing Resilient Policies. See the following `Block scaling_rule_timer`.
        """
        return pulumi.get(self, "scaling_rule_timer")

    @property
    @pulumi.getter(name="scalingRuleType")
    def scaling_rule_type(self) -> pulumi.Output[str]:
        """
        Flexible strategy type. Valid values: `mix`, `timing` and `metric`.
        """
        return pulumi.get(self, "scaling_rule_type")

