com.pulumi.alicloud.adb.Account 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.adb;
import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.adb.AccountArgs;
import com.pulumi.alicloud.adb.inputs.AccountState;
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.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a [ADB](https://www.alibabacloud.com/help/en/analyticdb-for-mysql/latest/api-doc-adb-2019-03-15-api-doc-createaccount) account resource and used to manage databases.
*
* > **NOTE:** Available since v1.71.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.adb.AdbFunctions;
* import com.pulumi.alicloud.adb.inputs.GetZonesArgs;
* import com.pulumi.alicloud.vpc.VpcFunctions;
* import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
* import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs;
* import com.pulumi.alicloud.adb.DBCluster;
* import com.pulumi.alicloud.adb.DBClusterArgs;
* import com.pulumi.alicloud.adb.Account;
* import com.pulumi.alicloud.adb.AccountArgs;
* 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 creation = config.get("creation").orElse("ADB");
* final var name = config.get("name").orElse("tfexample");
* final var default = AdbFunctions.getZones();
*
* final var defaultGetNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
* .nameRegex("^default-NODELETING$")
* .build());
*
* final var defaultGetSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
* .vpcId(defaultGetNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
* .zoneId(default_.ids()[0])
* .build());
*
* final var vswitchId = defaultGetSwitches.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]);
*
* var cluster = new DBCluster("cluster", DBClusterArgs.builder()
* .dbClusterCategory("MixedStorage")
* .mode("flexible")
* .computeResource("8Core32GB")
* .vswitchId(vswitchId)
* .description(name)
* .build());
*
* var defaultAccount = new Account("defaultAccount", AccountArgs.builder()
* .dbClusterId(cluster.id())
* .accountName(name)
* .accountPassword("tf_example123")
* .accountDescription(name)
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* ADB account can be imported using the id, e.g.
*
* ```sh
* $ pulumi import alicloud:adb/account:Account example am-12345:tf_account
* ```
*
*/
@ResourceType(type="alicloud:adb/account:Account")
public class Account extends com.pulumi.resources.CustomResource {
/**
* Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
*
*/
@Export(name="accountDescription", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> accountDescription;
/**
* @return Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
*
*/
public Output> accountDescription() {
return Codegen.optional(this.accountDescription);
}
/**
* Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
*
*/
@Export(name="accountName", refs={String.class}, tree="[0]")
private Output accountName;
/**
* @return Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
*
*/
public Output accountName() {
return this.accountName;
}
/**
* Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of `account_password` and `kms_encrypted_password` fields.
*
*/
@Export(name="accountPassword", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> accountPassword;
/**
* @return Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of `account_password` and `kms_encrypted_password` fields.
*
*/
public Output> accountPassword() {
return Codegen.optional(this.accountPassword);
}
/**
* The Id of cluster in which account belongs.
*
*/
@Export(name="dbClusterId", refs={String.class}, tree="[0]")
private Output dbClusterId;
/**
* @return The Id of cluster in which account belongs.
*
*/
public Output dbClusterId() {
return this.dbClusterId;
}
/**
* An KMS encrypts password used to a db account. If the `account_password` is filled in, this field will be ignored.
*
*/
@Export(name="kmsEncryptedPassword", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> kmsEncryptedPassword;
/**
* @return An KMS encrypts password used to a db account. If the `account_password` is filled in, this field will be ignored.
*
*/
public Output> kmsEncryptedPassword() {
return Codegen.optional(this.kmsEncryptedPassword);
}
/**
* An KMS encryption context used to decrypt `kms_encrypted_password` before creating or updating a db account with `kms_encrypted_password`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kms_encrypted_password` is set.
*
*/
@Export(name="kmsEncryptionContext", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> kmsEncryptionContext;
/**
* @return An KMS encryption context used to decrypt `kms_encrypted_password` before creating or updating a db account with `kms_encrypted_password`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kms_encrypted_password` is set.
*
*/
public Output>> kmsEncryptionContext() {
return Codegen.optional(this.kmsEncryptionContext);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Account(java.lang.String name) {
this(name, AccountArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Account(java.lang.String name, AccountArgs 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 Account(java.lang.String name, AccountArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:adb/account:Account", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Account(java.lang.String name, Output id, @Nullable AccountState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:adb/account:Account", name, state, makeResourceOptions(options, id), false);
}
private static AccountArgs makeArgs(AccountArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? AccountArgs.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 Account get(java.lang.String name, Output id, @Nullable AccountState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Account(name, id, state, options);
}
}