com.pulumi.alicloud.cddc.DedicatedHostAccount Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alicloud Show documentation
Show all versions of alicloud Show documentation
A Pulumi package for creating and managing AliCloud resources.
// *** 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.cddc;
import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.cddc.DedicatedHostAccountArgs;
import com.pulumi.alicloud.cddc.inputs.DedicatedHostAccountState;
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.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a ApsaraDB for MyBase Dedicated Host Account resource.
*
* For information about ApsaraDB for MyBase Dedicated Host Account and how to use it, see [What is Dedicated Host Account](https://www.alibabacloud.com/help/en/apsaradb-for-mybase/latest/creatededicatedhostaccount).
*
* > **NOTE:** Available since v1.148.0.
*
* > **NOTE:** Each Dedicated host can have only one account. Before you create an account for a host, make sure that the existing account is deleted.
*
* > **DEPRECATED:** This resource has been [deprecated](https://www.alibabacloud.com/help/en/apsaradb-for-mybase/latest/notice-stop-selling-mybase-hosted-instances-from-august-31-2023) from version `1.225.1`.
*
* ## Example Usage
*
* Basic Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.alicloud.cddc.CddcFunctions;
* import com.pulumi.alicloud.cddc.inputs.GetZonesArgs;
* import com.pulumi.alicloud.vpc.Network;
* import com.pulumi.alicloud.vpc.NetworkArgs;
* import com.pulumi.alicloud.vpc.Switch;
* import com.pulumi.alicloud.vpc.SwitchArgs;
* import com.pulumi.alicloud.cddc.DedicatedHostGroup;
* import com.pulumi.alicloud.cddc.DedicatedHostGroupArgs;
* import com.pulumi.alicloud.cddc.inputs.GetHostEcsLevelInfosArgs;
* import com.pulumi.alicloud.cddc.DedicatedHost;
* import com.pulumi.alicloud.cddc.DedicatedHostArgs;
* import com.pulumi.alicloud.cddc.DedicatedHostAccount;
* import com.pulumi.alicloud.cddc.DedicatedHostAccountArgs;
* 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 config = ctx.config();
* final var name = config.get("name").orElse("tf_example");
* final var default = CddcFunctions.getZones();
*
* var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
* .vpcName(name)
* .cidrBlock("10.4.0.0/16")
* .build());
*
* var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
* .vswitchName(name)
* .cidrBlock("10.4.0.0/24")
* .vpcId(defaultNetwork.id())
* .zoneId(default_.ids()[0])
* .build());
*
* var defaultDedicatedHostGroup = new DedicatedHostGroup("defaultDedicatedHostGroup", DedicatedHostGroupArgs.builder()
* .engine("MySQL")
* .vpcId(defaultNetwork.id())
* .cpuAllocationRatio(101)
* .memAllocationRatio(50)
* .diskAllocationRatio(200)
* .allocationPolicy("Evenly")
* .hostReplacePolicy("Manual")
* .dedicatedHostGroupDesc(name)
* .openPermission(true)
* .build());
*
* final var defaultGetHostEcsLevelInfos = CddcFunctions.getHostEcsLevelInfos(GetHostEcsLevelInfosArgs.builder()
* .dbType("mysql")
* .zoneId(default_.ids()[0])
* .storageType("cloud_essd")
* .build());
*
* var defaultDedicatedHost = new DedicatedHost("defaultDedicatedHost", DedicatedHostArgs.builder()
* .hostName(name)
* .dedicatedHostGroupId(defaultDedicatedHostGroup.id())
* .hostClass(defaultGetHostEcsLevelInfos.applyValue(getHostEcsLevelInfosResult -> getHostEcsLevelInfosResult.infos()[0].resClassCode()))
* .zoneId(default_.ids()[0])
* .vswitchId(defaultSwitch.id())
* .paymentType("Subscription")
* .tags(Map.ofEntries(
* Map.entry("Created", "TF"),
* Map.entry("For", "CDDC_DEDICATED")
* ))
* .build());
*
* var defaultDedicatedHostAccount = new DedicatedHostAccount("defaultDedicatedHostAccount", DedicatedHostAccountArgs.builder()
* .accountName(name)
* .accountPassword("Password1234")
* .dedicatedHostId(defaultDedicatedHost.dedicatedHostId())
* .accountType("Normal")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* ApsaraDB for MyBase Dedicated Host Account can be imported using the id, e.g.
*
* ```sh
* $ pulumi import alicloud:cddc/dedicatedHostAccount:DedicatedHostAccount example <dedicated_host_id>:<account_name>
* ```
*
*/
@ResourceType(type="alicloud:cddc/dedicatedHostAccount:DedicatedHostAccount")
public class DedicatedHostAccount extends com.pulumi.resources.CustomResource {
/**
* The name of the Dedicated host account. The account name must be 2 to 16 characters in length, contain lower case letters, digits, and underscore(_). At the same time, the name must start with a letter and end with a letter or number.
*
*/
@Export(name="accountName", refs={String.class}, tree="[0]")
private Output accountName;
/**
* @return The name of the Dedicated host account. The account name must be 2 to 16 characters in length, contain lower case letters, digits, and underscore(_). At the same time, the name must start with a letter and end with a letter or number.
*
*/
public Output accountName() {
return this.accountName;
}
/**
* The password of the Dedicated host account. The account password must be 6 to 32 characters in length, and can contain letters, digits, and special characters `!{@literal @}#$%^&*()_+-=`.
*
*/
@Export(name="accountPassword", refs={String.class}, tree="[0]")
private Output accountPassword;
/**
* @return The password of the Dedicated host account. The account password must be 6 to 32 characters in length, and can contain letters, digits, and special characters `!{@literal @}#$%^&*()_+-=`.
*
*/
public Output accountPassword() {
return this.accountPassword;
}
/**
* The type of the Dedicated host account. Valid values: `Admin`, `Normal`.
*
*/
@Export(name="accountType", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> accountType;
/**
* @return The type of the Dedicated host account. Valid values: `Admin`, `Normal`.
*
*/
public Output> accountType() {
return Codegen.optional(this.accountType);
}
/**
* The ID of Dedicated the host.
*
*/
@Export(name="dedicatedHostId", refs={String.class}, tree="[0]")
private Output dedicatedHostId;
/**
* @return The ID of Dedicated the host.
*
*/
public Output dedicatedHostId() {
return this.dedicatedHostId;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public DedicatedHostAccount(java.lang.String name) {
this(name, DedicatedHostAccountArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public DedicatedHostAccount(java.lang.String name, DedicatedHostAccountArgs 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 DedicatedHostAccount(java.lang.String name, DedicatedHostAccountArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:cddc/dedicatedHostAccount:DedicatedHostAccount", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private DedicatedHostAccount(java.lang.String name, Output id, @Nullable DedicatedHostAccountState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:cddc/dedicatedHostAccount:DedicatedHostAccount", name, state, makeResourceOptions(options, id), false);
}
private static DedicatedHostAccountArgs makeArgs(DedicatedHostAccountArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? DedicatedHostAccountArgs.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())
.additionalSecretOutputs(List.of(
"accountPassword"
))
.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 DedicatedHostAccount get(java.lang.String name, Output id, @Nullable DedicatedHostAccountState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new DedicatedHostAccount(name, id, state, options);
}
}