// *** 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.Cddc
{
    /// <summary>
    /// Provides a ApsaraDB for MyBase Dedicated Host resource.
    /// 
    /// For information about ApsaraDB for MyBase Dedicated Host and how to use it, see [What is Dedicated Host](https://www.alibabacloud.com/help/doc-detail/210864.html).
    /// 
    /// &gt; **NOTE:** Available in v1.147.0+.
    /// 
    /// ## Example Usage
    /// 
    /// Basic Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using AliCloud = Pulumi.AliCloud;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var defaultNetworks = AliCloud.Vpc.GetNetworks.Invoke(new()
    ///     {
    ///         NameRegex = "default-NODELETING",
    ///     });
    /// 
    ///     var defaultZones = AliCloud.Cddc.GetZones.Invoke();
    /// 
    ///     var defaultHostEcsLevelInfos = AliCloud.Cddc.GetHostEcsLevelInfos.Invoke(new()
    ///     {
    ///         DbType = "mysql",
    ///         ZoneId = defaultZones.Apply(getZonesResult =&gt; getZonesResult.Ids[0]),
    ///         StorageType = "cloud_essd",
    ///     });
    /// 
    ///     var defaultSwitches = AliCloud.Vpc.GetSwitches.Invoke(new()
    ///     {
    ///         VpcId = defaultNetworks.Apply(getNetworksResult =&gt; getNetworksResult.Ids[0]),
    ///         ZoneId = defaultZones.Apply(getZonesResult =&gt; getZonesResult.Ids[0]),
    ///     });
    /// 
    ///     var defaultDedicatedHostGroup = new AliCloud.Cddc.DedicatedHostGroup("defaultDedicatedHostGroup", new()
    ///     {
    ///         Engine = "MySQL",
    ///         VpcId = defaultNetworks.Apply(getNetworksResult =&gt; getNetworksResult.Ids[0]),
    ///         CpuAllocationRatio = 101,
    ///         MemAllocationRatio = 50,
    ///         DiskAllocationRatio = 200,
    ///         AllocationPolicy = "Evenly",
    ///         HostReplacePolicy = "Manual",
    ///         DedicatedHostGroupDesc = "example_value",
    ///     });
    /// 
    ///     var defaultDedicatedHost = new AliCloud.Cddc.DedicatedHost("defaultDedicatedHost", new()
    ///     {
    ///         HostName = "example_value",
    ///         DedicatedHostGroupId = defaultDedicatedHostGroup.Id,
    ///         HostClass = defaultHostEcsLevelInfos.Apply(getHostEcsLevelInfosResult =&gt; getHostEcsLevelInfosResult.Infos[0]?.ResClassCode),
    ///         ZoneId = defaultZones.Apply(getZonesResult =&gt; getZonesResult.Ids[0]),
    ///         VswitchId = defaultSwitches.Apply(getSwitchesResult =&gt; getSwitchesResult.Ids[0]),
    ///         PaymentType = "Subscription",
    ///         Tags = 
    ///         {
    ///             { "Created", "TF" },
    ///             { "For", "CDDC_DEDICATED" },
    ///         },
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// ApsaraDB for MyBase Dedicated Host can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:cddc/dedicatedHost:DedicatedHost example &lt;dedicated_host_group_id&gt;:&lt;dedicated_host_id&gt;
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:cddc/dedicatedHost:DedicatedHost")]
    public partial class DedicatedHost : global::Pulumi.CustomResource
    {
        /// <summary>
        /// Specifies whether instances can be created on the host. Valid values: `Allocatable` or `Suspended`. `Allocatable`: Instances can be created on the host. `Suspended`: Instances cannot be created on the host.
        /// </summary>
        [Output("allocationStatus")]
        public Output<string> AllocationStatus { get; private set; } = null!;

        /// <summary>
        /// Specifies whether to enable the auto-renewal feature.
        /// </summary>
        [Output("autoRenew")]
        public Output<bool?> AutoRenew { get; private set; } = null!;

        /// <summary>
        /// The ID of the dedicated cluster.
        /// </summary>
        [Output("dedicatedHostGroupId")]
        public Output<string> DedicatedHostGroupId { get; private set; } = null!;

        /// <summary>
        /// The ID of the host.
        /// </summary>
        [Output("dedicatedHostId")]
        public Output<string> DedicatedHostId { get; private set; } = null!;

        /// <summary>
        /// The instance type of the host. For more information about the supported instance types of hosts, see [Host specification details](https://www.alibabacloud.com/help/doc-detail/206343.htm).
        /// </summary>
        [Output("hostClass")]
        public Output<string> HostClass { get; private set; } = null!;

        /// <summary>
        /// The name of the host. The name must be `1` to `64` characters in length and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.
        /// </summary>
        [Output("hostName")]
        public Output<string> HostName { get; private set; } = null!;

        /// <summary>
        /// Host Image Category. Valid values: `WindowsWithMssqlEntAlwaysonLicense`, `WindowsWithMssqlStdLicense`, `WindowsWithMssqlEntLicense`, `WindowsWithMssqlWebLicense`, `AliLinux`.
        /// </summary>
        [Output("imageCategory")]
        public Output<string?> ImageCategory { get; private set; } = null!;

        /// <summary>
        /// Host password. **NOTE:** The creation of a host password is supported only when the database type is `Tair-PMem`.
        /// </summary>
        [Output("osPassword")]
        public Output<string?> OsPassword { get; private set; } = null!;

        /// <summary>
        /// The payment type of the resource. Valid values: `Subscription`.
        /// </summary>
        [Output("paymentType")]
        public Output<string> PaymentType { get; private set; } = null!;

        /// <summary>
        /// The unit of the subscription duration. Valid values: `Year`, `Month`, `Week`.
        /// </summary>
        [Output("period")]
        public Output<string?> Period { get; private set; } = null!;

        /// <summary>
        /// The state of the host. Valid values: `0:` The host is being created. `1`: The host is running. `2`: The host is faulty. `3`: The host is ready for deactivation. `4`: The host is being maintained. `5`: The host is deactivated. `6`: The host is restarting. `7`: The host is locked.
        /// </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>
        /// The subscription duration of the host. Valid values: 
        /// * If the Period parameter is set to `Year`, the value of the UsedTime parameter ranges from `1` to `5`.
        /// * If the Period parameter is set to `Month`, the value of the UsedTime parameter ranges from `1` to `9`.
        /// * If the Period parameter is set to `Week`, the value of the UsedTime parameter ranges from `1`, `2` and `3`.
        /// </summary>
        [Output("usedTime")]
        public Output<int?> UsedTime { get; private set; } = null!;

        /// <summary>
        /// The ID of the vSwitch to which the host is connected.
        /// </summary>
        [Output("vswitchId")]
        public Output<string> VswitchId { get; private set; } = null!;

        /// <summary>
        /// The ID of the zone.
        /// </summary>
        [Output("zoneId")]
        public Output<string> ZoneId { get; private set; } = null!;


        /// <summary>
        /// Create a DedicatedHost 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 DedicatedHost(string name, DedicatedHostArgs args, CustomResourceOptions? options = null)
            : base("alicloud:cddc/dedicatedHost:DedicatedHost", name, args ?? new DedicatedHostArgs(), MakeResourceOptions(options, ""))
        {
        }

        private DedicatedHost(string name, Input<string> id, DedicatedHostState? state = null, CustomResourceOptions? options = null)
            : base("alicloud:cddc/dedicatedHost:DedicatedHost", 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 DedicatedHost 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 DedicatedHost Get(string name, Input<string> id, DedicatedHostState? state = null, CustomResourceOptions? options = null)
        {
            return new DedicatedHost(name, id, state, options);
        }
    }

    public sealed class DedicatedHostArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// Specifies whether instances can be created on the host. Valid values: `Allocatable` or `Suspended`. `Allocatable`: Instances can be created on the host. `Suspended`: Instances cannot be created on the host.
        /// </summary>
        [Input("allocationStatus")]
        public Input<string>? AllocationStatus { get; set; }

        /// <summary>
        /// Specifies whether to enable the auto-renewal feature.
        /// </summary>
        [Input("autoRenew")]
        public Input<bool>? AutoRenew { get; set; }

        /// <summary>
        /// The ID of the dedicated cluster.
        /// </summary>
        [Input("dedicatedHostGroupId", required: true)]
        public Input<string> DedicatedHostGroupId { get; set; } = null!;

        /// <summary>
        /// The instance type of the host. For more information about the supported instance types of hosts, see [Host specification details](https://www.alibabacloud.com/help/doc-detail/206343.htm).
        /// </summary>
        [Input("hostClass", required: true)]
        public Input<string> HostClass { get; set; } = null!;

        /// <summary>
        /// The name of the host. The name must be `1` to `64` characters in length and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.
        /// </summary>
        [Input("hostName")]
        public Input<string>? HostName { get; set; }

        /// <summary>
        /// Host Image Category. Valid values: `WindowsWithMssqlEntAlwaysonLicense`, `WindowsWithMssqlStdLicense`, `WindowsWithMssqlEntLicense`, `WindowsWithMssqlWebLicense`, `AliLinux`.
        /// </summary>
        [Input("imageCategory")]
        public Input<string>? ImageCategory { get; set; }

        /// <summary>
        /// Host password. **NOTE:** The creation of a host password is supported only when the database type is `Tair-PMem`.
        /// </summary>
        [Input("osPassword")]
        public Input<string>? OsPassword { get; set; }

        /// <summary>
        /// The payment type of the resource. Valid values: `Subscription`.
        /// </summary>
        [Input("paymentType", required: true)]
        public Input<string> PaymentType { get; set; } = null!;

        /// <summary>
        /// The unit of the subscription duration. Valid values: `Year`, `Month`, `Week`.
        /// </summary>
        [Input("period")]
        public Input<string>? Period { 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>
        /// The subscription duration of the host. Valid values: 
        /// * If the Period parameter is set to `Year`, the value of the UsedTime parameter ranges from `1` to `5`.
        /// * If the Period parameter is set to `Month`, the value of the UsedTime parameter ranges from `1` to `9`.
        /// * If the Period parameter is set to `Week`, the value of the UsedTime parameter ranges from `1`, `2` and `3`.
        /// </summary>
        [Input("usedTime")]
        public Input<int>? UsedTime { get; set; }

        /// <summary>
        /// The ID of the vSwitch to which the host is connected.
        /// </summary>
        [Input("vswitchId", required: true)]
        public Input<string> VswitchId { get; set; } = null!;

        /// <summary>
        /// The ID of the zone.
        /// </summary>
        [Input("zoneId", required: true)]
        public Input<string> ZoneId { get; set; } = null!;

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

    public sealed class DedicatedHostState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// Specifies whether instances can be created on the host. Valid values: `Allocatable` or `Suspended`. `Allocatable`: Instances can be created on the host. `Suspended`: Instances cannot be created on the host.
        /// </summary>
        [Input("allocationStatus")]
        public Input<string>? AllocationStatus { get; set; }

        /// <summary>
        /// Specifies whether to enable the auto-renewal feature.
        /// </summary>
        [Input("autoRenew")]
        public Input<bool>? AutoRenew { get; set; }

        /// <summary>
        /// The ID of the dedicated cluster.
        /// </summary>
        [Input("dedicatedHostGroupId")]
        public Input<string>? DedicatedHostGroupId { get; set; }

        /// <summary>
        /// The ID of the host.
        /// </summary>
        [Input("dedicatedHostId")]
        public Input<string>? DedicatedHostId { get; set; }

        /// <summary>
        /// The instance type of the host. For more information about the supported instance types of hosts, see [Host specification details](https://www.alibabacloud.com/help/doc-detail/206343.htm).
        /// </summary>
        [Input("hostClass")]
        public Input<string>? HostClass { get; set; }

        /// <summary>
        /// The name of the host. The name must be `1` to `64` characters in length and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.
        /// </summary>
        [Input("hostName")]
        public Input<string>? HostName { get; set; }

        /// <summary>
        /// Host Image Category. Valid values: `WindowsWithMssqlEntAlwaysonLicense`, `WindowsWithMssqlStdLicense`, `WindowsWithMssqlEntLicense`, `WindowsWithMssqlWebLicense`, `AliLinux`.
        /// </summary>
        [Input("imageCategory")]
        public Input<string>? ImageCategory { get; set; }

        /// <summary>
        /// Host password. **NOTE:** The creation of a host password is supported only when the database type is `Tair-PMem`.
        /// </summary>
        [Input("osPassword")]
        public Input<string>? OsPassword { get; set; }

        /// <summary>
        /// The payment type of the resource. Valid values: `Subscription`.
        /// </summary>
        [Input("paymentType")]
        public Input<string>? PaymentType { get; set; }

        /// <summary>
        /// The unit of the subscription duration. Valid values: `Year`, `Month`, `Week`.
        /// </summary>
        [Input("period")]
        public Input<string>? Period { get; set; }

        /// <summary>
        /// The state of the host. Valid values: `0:` The host is being created. `1`: The host is running. `2`: The host is faulty. `3`: The host is ready for deactivation. `4`: The host is being maintained. `5`: The host is deactivated. `6`: The host is restarting. `7`: The host is locked.
        /// </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>
        /// The subscription duration of the host. Valid values: 
        /// * If the Period parameter is set to `Year`, the value of the UsedTime parameter ranges from `1` to `5`.
        /// * If the Period parameter is set to `Month`, the value of the UsedTime parameter ranges from `1` to `9`.
        /// * If the Period parameter is set to `Week`, the value of the UsedTime parameter ranges from `1`, `2` and `3`.
        /// </summary>
        [Input("usedTime")]
        public Input<int>? UsedTime { get; set; }

        /// <summary>
        /// The ID of the vSwitch to which the host is connected.
        /// </summary>
        [Input("vswitchId")]
        public Input<string>? VswitchId { get; set; }

        /// <summary>
        /// The ID of the zone.
        /// </summary>
        [Input("zoneId")]
        public Input<string>? ZoneId { get; set; }

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