# 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables

class ReservedInstance(pulumi.CustomResource):
    description: pulumi.Output[str]
    """
    Description of the RI. 2 to 256 English or Chinese characters. It cannot start with http:// or https://.
    """
    instance_amount: pulumi.Output[float]
    """
    Number of instances allocated to an RI (An RI is a coupon that includes one or more allocated instances.).
    """
    instance_type: pulumi.Output[str]
    """
    Instance type of the RI. For more information, see [Instance type families](https://www.alibabacloud.com/help/doc-detail/25378.html).
    """
    name: pulumi.Output[str]
    """
    Name of the RI. The name must be a string of 2 to 128 characters in length and can contain letters, numbers, colons (:), underscores (_), and hyphens. It must start with a letter. It cannot start with http:// or https://.
    """
    offering_type: pulumi.Output[str]
    """
    Payment type of the RI. Optional values: `No Upfront`: No upfront payment is required., `Partial Upfront`: A portion of upfront payment is required.`All Upfront`: Full upfront payment is required.
    """
    period: pulumi.Output[float]
    period_unit: pulumi.Output[str]
    """
    Term unit. Optional value: Year.
    """
    platform: pulumi.Output[str]
    """
    The operating system type of the image used by the instance. Optional values: `Windows`, `Linux`. Default is `Linux`.
    """
    resource_group_id: pulumi.Output[str]
    """
    Resource group ID.
    """
    scope: pulumi.Output[str]
    """
    Scope of the RI. Optional values: `Region`: region-level, `Zone`: zone-level. Default is `Region`.
    """
    zone_id: pulumi.Output[str]
    """
    ID of the zone to which the RI belongs. When Scope is set to Zone, this parameter is required. For information about the zone list, see [DescribeZones](https://www.alibabacloud.com/help/doc-detail/25610.html).
    """
    def __init__(__self__, resource_name, opts=None, description=None, instance_amount=None, instance_type=None, name=None, offering_type=None, period=None, period_unit=None, platform=None, resource_group_id=None, scope=None, zone_id=None, __props__=None, __name__=None, __opts__=None):
        """
        Provides an Reserved Instance resource.

        > **NOTE:** Available in 1.65.0+

        > This content is derived from https://github.com/terraform-providers/terraform-provider-alicloud/blob/master/website/docs/r/reserved_instance.html.markdown.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] description: Description of the RI. 2 to 256 English or Chinese characters. It cannot start with http:// or https://.
        :param pulumi.Input[float] instance_amount: Number of instances allocated to an RI (An RI is a coupon that includes one or more allocated instances.).
        :param pulumi.Input[str] instance_type: Instance type of the RI. For more information, see [Instance type families](https://www.alibabacloud.com/help/doc-detail/25378.html).
        :param pulumi.Input[str] name: Name of the RI. The name must be a string of 2 to 128 characters in length and can contain letters, numbers, colons (:), underscores (_), and hyphens. It must start with a letter. It cannot start with http:// or https://.
        :param pulumi.Input[str] offering_type: Payment type of the RI. Optional values: `No Upfront`: No upfront payment is required., `Partial Upfront`: A portion of upfront payment is required.`All Upfront`: Full upfront payment is required.
        :param pulumi.Input[str] period_unit: Term unit. Optional value: Year.
        :param pulumi.Input[str] platform: The operating system type of the image used by the instance. Optional values: `Windows`, `Linux`. Default is `Linux`.
        :param pulumi.Input[str] resource_group_id: Resource group ID.
        :param pulumi.Input[str] scope: Scope of the RI. Optional values: `Region`: region-level, `Zone`: zone-level. Default is `Region`.
        :param pulumi.Input[str] zone_id: ID of the zone to which the RI belongs. When Scope is set to Zone, this parameter is required. For information about the zone list, see [DescribeZones](https://www.alibabacloud.com/help/doc-detail/25610.html).
        """
        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()

            __props__['description'] = description
            __props__['instance_amount'] = instance_amount
            if instance_type is None:
                raise TypeError("Missing required property 'instance_type'")
            __props__['instance_type'] = instance_type
            __props__['name'] = name
            __props__['offering_type'] = offering_type
            __props__['period'] = period
            __props__['period_unit'] = period_unit
            __props__['platform'] = platform
            __props__['resource_group_id'] = resource_group_id
            __props__['scope'] = scope
            __props__['zone_id'] = zone_id
        super(ReservedInstance, __self__).__init__(
            'alicloud:ecs/reservedInstance:ReservedInstance',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name, id, opts=None, description=None, instance_amount=None, instance_type=None, name=None, offering_type=None, period=None, period_unit=None, platform=None, resource_group_id=None, scope=None, zone_id=None):
        """
        Get an existing ReservedInstance 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 str id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] description: Description of the RI. 2 to 256 English or Chinese characters. It cannot start with http:// or https://.
        :param pulumi.Input[float] instance_amount: Number of instances allocated to an RI (An RI is a coupon that includes one or more allocated instances.).
        :param pulumi.Input[str] instance_type: Instance type of the RI. For more information, see [Instance type families](https://www.alibabacloud.com/help/doc-detail/25378.html).
        :param pulumi.Input[str] name: Name of the RI. The name must be a string of 2 to 128 characters in length and can contain letters, numbers, colons (:), underscores (_), and hyphens. It must start with a letter. It cannot start with http:// or https://.
        :param pulumi.Input[str] offering_type: Payment type of the RI. Optional values: `No Upfront`: No upfront payment is required., `Partial Upfront`: A portion of upfront payment is required.`All Upfront`: Full upfront payment is required.
        :param pulumi.Input[str] period_unit: Term unit. Optional value: Year.
        :param pulumi.Input[str] platform: The operating system type of the image used by the instance. Optional values: `Windows`, `Linux`. Default is `Linux`.
        :param pulumi.Input[str] resource_group_id: Resource group ID.
        :param pulumi.Input[str] scope: Scope of the RI. Optional values: `Region`: region-level, `Zone`: zone-level. Default is `Region`.
        :param pulumi.Input[str] zone_id: ID of the zone to which the RI belongs. When Scope is set to Zone, this parameter is required. For information about the zone list, see [DescribeZones](https://www.alibabacloud.com/help/doc-detail/25610.html).
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["description"] = description
        __props__["instance_amount"] = instance_amount
        __props__["instance_type"] = instance_type
        __props__["name"] = name
        __props__["offering_type"] = offering_type
        __props__["period"] = period
        __props__["period_unit"] = period_unit
        __props__["platform"] = platform
        __props__["resource_group_id"] = resource_group_id
        __props__["scope"] = scope
        __props__["zone_id"] = zone_id
        return ReservedInstance(resource_name, opts=opts, __props__=__props__)
    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

