<filename>sdk/dotnet/Ecs/ReservedInstance.cs// *** 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! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.AliCloud.Ecs
{
    /// <summary>
    /// Provides an Reserved Instance resource.
    /// 
    /// &gt; **NOTE:** Available in 1.65.0+
    /// 
    /// ## Example Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using AliCloud = Pulumi.AliCloud;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var @default = new AliCloud.Ecs.ReservedInstance("default", new()
    ///     {
    ///         InstanceType = "ecs.g6.large",
    ///         InstanceAmount = 1,
    ///         PeriodUnit = "Year",
    ///         OfferingType = "All Upfront",
    ///         Description = "ReservedInstance",
    ///         ZoneId = "cn-hangzhou-h",
    ///         Scope = "Zone",
    ///         Period = 1,
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// reservedInstance can be imported using id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:ecs/reservedInstance:ReservedInstance default ecsri-uf6df4xm0h3licit****
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:ecs/reservedInstance:ReservedInstance")]
    public partial class ReservedInstance : global::Pulumi.CustomResource
    {
        /// <summary>
        /// Indicates the sharing status of the reserved instance when the AllocationType parameter is set to Shared. Valid values: `allocated`: The reserved instance is allocated to another account. `beAllocated`: The reserved instance is allocated by another account.
        /// </summary>
        [Output("allocationStatus")]
        public Output<string> AllocationStatus { get; private set; } = null!;

        /// <summary>
        /// The auto-renewal term of the reserved instance. This parameter takes effect only when AutoRenew is set to true. Valid values: 1, 12, 36, and 60. Default value when `period_unit` is set to Month: 1 Default value when `period_unit` is set to Year: 12
        /// </summary>
        [Output("autoRenewPeriod")]
        public Output<int> AutoRenewPeriod { get; private set; } = null!;

        /// <summary>
        /// The time when the reserved instance was created.
        /// </summary>
        [Output("createTime")]
        public Output<string> CreateTime { get; private set; } = null!;

        /// <summary>
        /// Description of the RI. 2 to 256 English or Chinese characters. It cannot start with `http://` or `https://`.
        /// </summary>
        [Output("description")]
        public Output<string?> Description { get; private set; } = null!;

        /// <summary>
        /// The time when the reserved instance expires.
        /// </summary>
        [Output("expiredTime")]
        public Output<string> ExpiredTime { get; private set; } = null!;

        /// <summary>
        /// Number of instances allocated to an RI (An RI is a coupon that includes one or more allocated instances.).
        /// </summary>
        [Output("instanceAmount")]
        public Output<int> InstanceAmount { get; private set; } = null!;

        /// <summary>
        /// Instance type of the RI. For more information, see [Instance type families](https://www.alibabacloud.com/help/doc-detail/25378.html).
        /// </summary>
        [Output("instanceType")]
        public Output<string> InstanceType { get; private set; } = null!;

        /// <summary>
        /// Field `name` has been deprecated from provider version 1.194.0. New field `reserved_instance_name` instead.
        /// </summary>
        [Output("name")]
        public Output<string> Name { get; private set; } = null!;

        /// <summary>
        /// Payment type of the RI. Default value: `All Upfront`. Valid values:
        /// - `No Upfront`: No upfront payment.
        /// - `Partial Upfront`: A portion of upfront payment.
        /// - `All Upfront`: Full upfront payment.
        /// </summary>
        [Output("offeringType")]
        public Output<string> OfferingType { get; private set; } = null!;

        /// <summary>
        /// Details about the lock status of the reserved instance.
        /// </summary>
        [Output("operationLocks")]
        public Output<ImmutableArray<Outputs.ReservedInstanceOperationLock>> OperationLocks { get; private set; } = null!;

        /// <summary>
        /// The validity period of the reserved instance. Default value: `1`. **NOTE:** From version 1.183.0, `period` can be set to `5`, when `period_unit` is `Year`.
        /// - When `period_unit` is `Year`, Valid values: `1`, `3`, `5`.
        /// - When `period_unit` is `Month`, Valid values: `1`.
        /// </summary>
        [Output("period")]
        public Output<int?> Period { get; private set; } = null!;

        /// <summary>
        /// The unit of the validity period of the reserved instance. Valid value: `Month`, `Year`. Default value: `Year`. **NOTE:** From version 1.183.0, `period_unit` can be set to `Month`.
        /// </summary>
        [Output("periodUnit")]
        public Output<string?> PeriodUnit { get; private set; } = null!;

        /// <summary>
        /// The operating system type of the image used by the instance. Optional values: `Windows`, `Linux`. Default is `Linux`.
        /// </summary>
        [Output("platform")]
        public Output<string> Platform { get; private set; } = null!;

        /// <summary>
        /// Automatic renewal status. Valid values: `AutoRenewal`,`Normal`.
        /// </summary>
        [Output("renewalStatus")]
        public Output<string> RenewalStatus { get; private set; } = null!;

        /// <summary>
        /// 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://.
        /// </summary>
        [Output("reservedInstanceName")]
        public Output<string> ReservedInstanceName { get; private set; } = null!;

        /// <summary>
        /// Resource group ID.
        /// </summary>
        [Output("resourceGroupId")]
        public Output<string> ResourceGroupId { get; private set; } = null!;

        /// <summary>
        /// Scope of the RI. Optional values: `Region`: region-level, `Zone`: zone-level. Default is `Region`.
        /// </summary>
        [Output("scope")]
        public Output<string> Scope { get; private set; } = null!;

        /// <summary>
        /// The time when the reserved instance took effect.
        /// </summary>
        [Output("startTime")]
        public Output<string> StartTime { get; private set; } = null!;

        /// <summary>
        /// The status of the reserved instance.
        /// </summary>
        [Output("status")]
        public Output<string> Status { get; private set; } = null!;

        /// <summary>
        /// A mapping of tags to assign to the resource.
        /// </summary>
        [Output("tags")]
        public Output<ImmutableDictionary<string, object>?> Tags { get; private set; } = null!;

        /// <summary>
        /// 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).
        /// </summary>
        [Output("zoneId")]
        public Output<string?> ZoneId { get; private set; } = null!;


        /// <summary>
        /// Create a ReservedInstance resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public ReservedInstance(string name, ReservedInstanceArgs args, CustomResourceOptions? options = null)
            : base("alicloud:ecs/reservedInstance:ReservedInstance", name, args ?? new ReservedInstanceArgs(), MakeResourceOptions(options, ""))
        {
        }

        private ReservedInstance(string name, Input<string> id, ReservedInstanceState? state = null, CustomResourceOptions? options = null)
            : base("alicloud:ecs/reservedInstance:ReservedInstance", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "github://api.github.com/rhysmdnz/pulumi-alicloud",
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing ReservedInstance resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static ReservedInstance Get(string name, Input<string> id, ReservedInstanceState? state = null, CustomResourceOptions? options = null)
        {
            return new ReservedInstance(name, id, state, options);
        }
    }

    public sealed class ReservedInstanceArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The auto-renewal term of the reserved instance. This parameter takes effect only when AutoRenew is set to true. Valid values: 1, 12, 36, and 60. Default value when `period_unit` is set to Month: 1 Default value when `period_unit` is set to Year: 12
        /// </summary>
        [Input("autoRenewPeriod")]
        public Input<int>? AutoRenewPeriod { get; set; }

        /// <summary>
        /// Description of the RI. 2 to 256 English or Chinese characters. It cannot start with `http://` or `https://`.
        /// </summary>
        [Input("description")]
        public Input<string>? Description { get; set; }

        /// <summary>
        /// Number of instances allocated to an RI (An RI is a coupon that includes one or more allocated instances.).
        /// </summary>
        [Input("instanceAmount")]
        public Input<int>? InstanceAmount { get; set; }

        /// <summary>
        /// Instance type of the RI. For more information, see [Instance type families](https://www.alibabacloud.com/help/doc-detail/25378.html).
        /// </summary>
        [Input("instanceType", required: true)]
        public Input<string> InstanceType { get; set; } = null!;

        /// <summary>
        /// Field `name` has been deprecated from provider version 1.194.0. New field `reserved_instance_name` instead.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// Payment type of the RI. Default value: `All Upfront`. Valid values:
        /// - `No Upfront`: No upfront payment.
        /// - `Partial Upfront`: A portion of upfront payment.
        /// - `All Upfront`: Full upfront payment.
        /// </summary>
        [Input("offeringType")]
        public Input<string>? OfferingType { get; set; }

        /// <summary>
        /// The validity period of the reserved instance. Default value: `1`. **NOTE:** From version 1.183.0, `period` can be set to `5`, when `period_unit` is `Year`.
        /// - When `period_unit` is `Year`, Valid values: `1`, `3`, `5`.
        /// - When `period_unit` is `Month`, Valid values: `1`.
        /// </summary>
        [Input("period")]
        public Input<int>? Period { get; set; }

        /// <summary>
        /// The unit of the validity period of the reserved instance. Valid value: `Month`, `Year`. Default value: `Year`. **NOTE:** From version 1.183.0, `period_unit` can be set to `Month`.
        /// </summary>
        [Input("periodUnit")]
        public Input<string>? PeriodUnit { get; set; }

        /// <summary>
        /// The operating system type of the image used by the instance. Optional values: `Windows`, `Linux`. Default is `Linux`.
        /// </summary>
        [Input("platform")]
        public Input<string>? Platform { get; set; }

        /// <summary>
        /// Automatic renewal status. Valid values: `AutoRenewal`,`Normal`.
        /// </summary>
        [Input("renewalStatus")]
        public Input<string>? RenewalStatus { get; set; }

        /// <summary>
        /// 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://.
        /// </summary>
        [Input("reservedInstanceName")]
        public Input<string>? ReservedInstanceName { get; set; }

        /// <summary>
        /// Resource group ID.
        /// </summary>
        [Input("resourceGroupId")]
        public Input<string>? ResourceGroupId { get; set; }

        /// <summary>
        /// Scope of the RI. Optional values: `Region`: region-level, `Zone`: zone-level. Default is `Region`.
        /// </summary>
        [Input("scope")]
        public Input<string>? Scope { get; set; }

        [Input("tags")]
        private InputMap<object>? _tags;

        /// <summary>
        /// A mapping of tags to assign to the resource.
        /// </summary>
        public InputMap<object> Tags
        {
            get => _tags ?? (_tags = new InputMap<object>());
            set => _tags = value;
        }

        /// <summary>
        /// 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).
        /// </summary>
        [Input("zoneId")]
        public Input<string>? ZoneId { get; set; }

        public ReservedInstanceArgs()
        {
        }
        public static new ReservedInstanceArgs Empty => new ReservedInstanceArgs();
    }

    public sealed class ReservedInstanceState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// Indicates the sharing status of the reserved instance when the AllocationType parameter is set to Shared. Valid values: `allocated`: The reserved instance is allocated to another account. `beAllocated`: The reserved instance is allocated by another account.
        /// </summary>
        [Input("allocationStatus")]
        public Input<string>? AllocationStatus { get; set; }

        /// <summary>
        /// The auto-renewal term of the reserved instance. This parameter takes effect only when AutoRenew is set to true. Valid values: 1, 12, 36, and 60. Default value when `period_unit` is set to Month: 1 Default value when `period_unit` is set to Year: 12
        /// </summary>
        [Input("autoRenewPeriod")]
        public Input<int>? AutoRenewPeriod { get; set; }

        /// <summary>
        /// The time when the reserved instance was created.
        /// </summary>
        [Input("createTime")]
        public Input<string>? CreateTime { get; set; }

        /// <summary>
        /// Description of the RI. 2 to 256 English or Chinese characters. It cannot start with `http://` or `https://`.
        /// </summary>
        [Input("description")]
        public Input<string>? Description { get; set; }

        /// <summary>
        /// The time when the reserved instance expires.
        /// </summary>
        [Input("expiredTime")]
        public Input<string>? ExpiredTime { get; set; }

        /// <summary>
        /// Number of instances allocated to an RI (An RI is a coupon that includes one or more allocated instances.).
        /// </summary>
        [Input("instanceAmount")]
        public Input<int>? InstanceAmount { get; set; }

        /// <summary>
        /// Instance type of the RI. For more information, see [Instance type families](https://www.alibabacloud.com/help/doc-detail/25378.html).
        /// </summary>
        [Input("instanceType")]
        public Input<string>? InstanceType { get; set; }

        /// <summary>
        /// Field `name` has been deprecated from provider version 1.194.0. New field `reserved_instance_name` instead.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// Payment type of the RI. Default value: `All Upfront`. Valid values:
        /// - `No Upfront`: No upfront payment.
        /// - `Partial Upfront`: A portion of upfront payment.
        /// - `All Upfront`: Full upfront payment.
        /// </summary>
        [Input("offeringType")]
        public Input<string>? OfferingType { get; set; }

        [Input("operationLocks")]
        private InputList<Inputs.ReservedInstanceOperationLockGetArgs>? _operationLocks;

        /// <summary>
        /// Details about the lock status of the reserved instance.
        /// </summary>
        public InputList<Inputs.ReservedInstanceOperationLockGetArgs> OperationLocks
        {
            get => _operationLocks ?? (_operationLocks = new InputList<Inputs.ReservedInstanceOperationLockGetArgs>());
            set => _operationLocks = value;
        }

        /// <summary>
        /// The validity period of the reserved instance. Default value: `1`. **NOTE:** From version 1.183.0, `period` can be set to `5`, when `period_unit` is `Year`.
        /// - When `period_unit` is `Year`, Valid values: `1`, `3`, `5`.
        /// - When `period_unit` is `Month`, Valid values: `1`.
        /// </summary>
        [Input("period")]
        public Input<int>? Period { get; set; }

        /// <summary>
        /// The unit of the validity period of the reserved instance. Valid value: `Month`, `Year`. Default value: `Year`. **NOTE:** From version 1.183.0, `period_unit` can be set to `Month`.
        /// </summary>
        [Input("periodUnit")]
        public Input<string>? PeriodUnit { get; set; }

        /// <summary>
        /// The operating system type of the image used by the instance. Optional values: `Windows`, `Linux`. Default is `Linux`.
        /// </summary>
        [Input("platform")]
        public Input<string>? Platform { get; set; }

        /// <summary>
        /// Automatic renewal status. Valid values: `AutoRenewal`,`Normal`.
        /// </summary>
        [Input("renewalStatus")]
        public Input<string>? RenewalStatus { get; set; }

        /// <summary>
        /// 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://.
        /// </summary>
        [Input("reservedInstanceName")]
        public Input<string>? ReservedInstanceName { get; set; }

        /// <summary>
        /// Resource group ID.
        /// </summary>
        [Input("resourceGroupId")]
        public Input<string>? ResourceGroupId { get; set; }

        /// <summary>
        /// Scope of the RI. Optional values: `Region`: region-level, `Zone`: zone-level. Default is `Region`.
        /// </summary>
        [Input("scope")]
        public Input<string>? Scope { get; set; }

        /// <summary>
        /// The time when the reserved instance took effect.
        /// </summary>
        [Input("startTime")]
        public Input<string>? StartTime { get; set; }

        /// <summary>
        /// The status of the reserved instance.
        /// </summary>
        [Input("status")]
        public Input<string>? Status { get; set; }

        [Input("tags")]
        private InputMap<object>? _tags;

        /// <summary>
        /// A mapping of tags to assign to the resource.
        /// </summary>
        public InputMap<object> Tags
        {
            get => _tags ?? (_tags = new InputMap<object>());
            set => _tags = value;
        }

        /// <summary>
        /// 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).
        /// </summary>
        [Input("zoneId")]
        public Input<string>? ZoneId { get; set; }

        public ReservedInstanceState()
        {
        }
        public static new ReservedInstanceState Empty => new ReservedInstanceState();
    }
}
