All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.alicloud.ecs.ReservedInstance Maven / Gradle / Ivy

There is a newer version: 3.63.0-alpha.1727424957
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.alicloud.ecs;

import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.ecs.ReservedInstanceArgs;
import com.pulumi.alicloud.ecs.inputs.ReservedInstanceState;
import com.pulumi.alicloud.ecs.outputs.ReservedInstanceOperationLock;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Provides an Reserved Instance resource.
 * 
 * > **NOTE:** Available in 1.65.0+
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.alicloud.ecs.EcsFunctions;
 * import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
 * import com.pulumi.alicloud.ecs.ReservedInstance;
 * import com.pulumi.alicloud.ecs.ReservedInstanceArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         final var default = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
 *             .instanceTypeFamily("ecs.g6")
 *             .build());
 * 
 *         var defaultReservedInstance = new ReservedInstance("defaultReservedInstance", ReservedInstanceArgs.builder()
 *             .instanceType(default_.instanceTypes()[0].id())
 *             .instanceAmount("1")
 *             .periodUnit("Month")
 *             .offeringType("All Upfront")
 *             .reservedInstanceName("terraform-example")
 *             .description("ReservedInstance")
 *             .zoneId(default_.instanceTypes()[0].availabilityZones()[0])
 *             .scope("Zone")
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * reservedInstance can be imported using id, e.g. * * ```sh * $ pulumi import alicloud:ecs/reservedInstance:ReservedInstance default ecsri-uf6df4xm0h3licit**** * ``` * */ @ResourceType(type="alicloud:ecs/reservedInstance:ReservedInstance") public class ReservedInstance extends com.pulumi.resources.CustomResource { /** * 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. * */ @Export(name="allocationStatus", refs={String.class}, tree="[0]") private Output allocationStatus; /** * @return 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. * */ public Output allocationStatus() { return this.allocationStatus; } /** * 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 * */ @Export(name="autoRenewPeriod", refs={Integer.class}, tree="[0]") private Output autoRenewPeriod; /** * @return 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 * */ public Output autoRenewPeriod() { return this.autoRenewPeriod; } /** * The time when the reserved instance was created. * */ @Export(name="createTime", refs={String.class}, tree="[0]") private Output createTime; /** * @return The time when the reserved instance was created. * */ public Output createTime() { return this.createTime; } /** * Description of the RI. 2 to 256 English or Chinese characters. It cannot start with `http://` or `https://`. * */ @Export(name="description", refs={String.class}, tree="[0]") private Output description; /** * @return Description of the RI. 2 to 256 English or Chinese characters. It cannot start with `http://` or `https://`. * */ public Output> description() { return Codegen.optional(this.description); } /** * The time when the reserved instance expires. * */ @Export(name="expiredTime", refs={String.class}, tree="[0]") private Output expiredTime; /** * @return The time when the reserved instance expires. * */ public Output expiredTime() { return this.expiredTime; } /** * Number of instances allocated to an RI (An RI is a coupon that includes one or more allocated instances.). * */ @Export(name="instanceAmount", refs={Integer.class}, tree="[0]") private Output instanceAmount; /** * @return Number of instances allocated to an RI (An RI is a coupon that includes one or more allocated instances.). * */ public Output instanceAmount() { return this.instanceAmount; } /** * Instance type of the RI. For more information, see [Instance type families](https://www.alibabacloud.com/help/doc-detail/25378.html). * */ @Export(name="instanceType", refs={String.class}, tree="[0]") private Output instanceType; /** * @return Instance type of the RI. For more information, see [Instance type families](https://www.alibabacloud.com/help/doc-detail/25378.html). * */ public Output instanceType() { return this.instanceType; } /** * Field `name` has been deprecated from provider version 1.194.0. New field `reserved_instance_name` instead. * * @deprecated * Field 'name' has been deprecated from provider version 1.194.0. New field 'reserved_instance_name' instead. * */ @Deprecated /* Field 'name' has been deprecated from provider version 1.194.0. New field 'reserved_instance_name' instead. */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return Field `name` has been deprecated from provider version 1.194.0. New field `reserved_instance_name` instead. * */ public Output name() { return this.name; } /** * 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. * */ @Export(name="offeringType", refs={String.class}, tree="[0]") private Output offeringType; /** * @return 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. * */ public Output offeringType() { return this.offeringType; } /** * Details about the lock status of the reserved instance. * */ @Export(name="operationLocks", refs={List.class,ReservedInstanceOperationLock.class}, tree="[0,1]") private Output> operationLocks; /** * @return Details about the lock status of the reserved instance. * */ public Output> operationLocks() { return this.operationLocks; } /** * 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`. * */ @Export(name="period", refs={Integer.class}, tree="[0]") private Output period; /** * @return 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`. * */ public Output> period() { return Codegen.optional(this.period); } /** * 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`. * */ @Export(name="periodUnit", refs={String.class}, tree="[0]") private Output periodUnit; /** * @return 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`. * */ public Output> periodUnit() { return Codegen.optional(this.periodUnit); } /** * The operating system type of the image used by the instance. Optional values: `Windows`, `Linux`. Default is `Linux`. * */ @Export(name="platform", refs={String.class}, tree="[0]") private Output platform; /** * @return The operating system type of the image used by the instance. Optional values: `Windows`, `Linux`. Default is `Linux`. * */ public Output platform() { return this.platform; } /** * Automatic renewal status. Valid values: `AutoRenewal`,`Normal`. * */ @Export(name="renewalStatus", refs={String.class}, tree="[0]") private Output renewalStatus; /** * @return Automatic renewal status. Valid values: `AutoRenewal`,`Normal`. * */ public Output renewalStatus() { return this.renewalStatus; } /** * 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://. * */ @Export(name="reservedInstanceName", refs={String.class}, tree="[0]") private Output reservedInstanceName; /** * @return 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://. * */ public Output reservedInstanceName() { return this.reservedInstanceName; } /** * Resource group ID. * */ @Export(name="resourceGroupId", refs={String.class}, tree="[0]") private Output resourceGroupId; /** * @return Resource group ID. * */ public Output resourceGroupId() { return this.resourceGroupId; } /** * Scope of the RI. Optional values: `Region`: region-level, `Zone`: zone-level. Default is `Region`. * */ @Export(name="scope", refs={String.class}, tree="[0]") private Output scope; /** * @return Scope of the RI. Optional values: `Region`: region-level, `Zone`: zone-level. Default is `Region`. * */ public Output scope() { return this.scope; } /** * The time when the reserved instance took effect. * */ @Export(name="startTime", refs={String.class}, tree="[0]") private Output startTime; /** * @return The time when the reserved instance took effect. * */ public Output startTime() { return this.startTime; } /** * The status of the reserved instance. * */ @Export(name="status", refs={String.class}, tree="[0]") private Output status; /** * @return The status of the reserved instance. * */ public Output status() { return this.status; } /** * A mapping of tags to assign to the resource. * */ @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tags; /** * @return A mapping of tags to assign to the resource. * */ public Output>> tags() { return Codegen.optional(this.tags); } /** * 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). * */ @Export(name="zoneId", refs={String.class}, tree="[0]") private Output zoneId; /** * @return 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). * */ public Output> zoneId() { return Codegen.optional(this.zoneId); } /** * * @param name The _unique_ name of the resulting resource. */ public ReservedInstance(java.lang.String name) { this(name, ReservedInstanceArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public ReservedInstance(java.lang.String name, ReservedInstanceArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public ReservedInstance(java.lang.String name, ReservedInstanceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:ecs/reservedInstance:ReservedInstance", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private ReservedInstance(java.lang.String name, Output id, @Nullable ReservedInstanceState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:ecs/reservedInstance:ReservedInstance", name, state, makeResourceOptions(options, id), false); } private static ReservedInstanceArgs makeArgs(ReservedInstanceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? ReservedInstanceArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state * @param options Optional settings to control the behavior of the CustomResource. */ public static ReservedInstance get(java.lang.String name, Output id, @Nullable ReservedInstanceState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new ReservedInstance(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy