com.pulumi.alicloud.adb.Connection 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.ConnectionArgs;
import com.pulumi.alicloud.adb.inputs.ConnectionState;
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 javax.annotation.Nullable;
/**
* Provides an ADB connection resource to allocate an Internet connection string for ADB cluster.
*
* > **NOTE:** Each ADB instance will allocate a intranet connnection string automatically and its prifix is ADB instance ID.
* To avoid unnecessary conflict, please specified a internet connection prefix before applying the resource.
*
* > **NOTE:** Available since v1.81.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.Connection;
* import com.pulumi.alicloud.adb.ConnectionArgs;
* 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("terraform-example");
* 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 defaultConnection = new Connection("defaultConnection", ConnectionArgs.builder()
* .dbClusterId(cluster.id())
* .connectionPrefix("example")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* ADB connection can be imported using the id, e.g.
*
* ```sh
* $ pulumi import alicloud:adb/connection:Connection example am-12345678
* ```
*
*/
@ResourceType(type="alicloud:adb/connection:Connection")
public class Connection extends com.pulumi.resources.CustomResource {
/**
* Prefix of the cluster public endpoint. The prefix must be 6 to 30 characters in length, and can contain lowercase letters, digits, and hyphens (-), must start with a letter and end with a digit or letter. Default to `<db_cluster_id> + tf`.
*
*/
@Export(name="connectionPrefix", refs={String.class}, tree="[0]")
private Output connectionPrefix;
/**
* @return Prefix of the cluster public endpoint. The prefix must be 6 to 30 characters in length, and can contain lowercase letters, digits, and hyphens (-), must start with a letter and end with a digit or letter. Default to `<db_cluster_id> + tf`.
*
*/
public Output connectionPrefix() {
return this.connectionPrefix;
}
/**
* Connection cluster string.
*
*/
@Export(name="connectionString", refs={String.class}, tree="[0]")
private Output connectionString;
/**
* @return Connection cluster string.
*
*/
public Output connectionString() {
return this.connectionString;
}
/**
* The Id of cluster that can run database.
*
*/
@Export(name="dbClusterId", refs={String.class}, tree="[0]")
private Output dbClusterId;
/**
* @return The Id of cluster that can run database.
*
*/
public Output dbClusterId() {
return this.dbClusterId;
}
/**
* The ip address of connection string.
*
*/
@Export(name="ipAddress", refs={String.class}, tree="[0]")
private Output ipAddress;
/**
* @return The ip address of connection string.
*
*/
public Output ipAddress() {
return this.ipAddress;
}
/**
* Connection cluster port.
*
*/
@Export(name="port", refs={String.class}, tree="[0]")
private Output port;
/**
* @return Connection cluster port.
*
*/
public Output port() {
return this.port;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Connection(java.lang.String name) {
this(name, ConnectionArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Connection(java.lang.String name, ConnectionArgs 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 Connection(java.lang.String name, ConnectionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:adb/connection:Connection", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Connection(java.lang.String name, Output id, @Nullable ConnectionState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:adb/connection:Connection", name, state, makeResourceOptions(options, id), false);
}
private static ConnectionArgs makeArgs(ConnectionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ConnectionArgs.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 Connection get(java.lang.String name, Output id, @Nullable ConnectionState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Connection(name, id, state, options);
}
}