com.pulumi.alicloud.rds.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.rds;
import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.rds.ConnectionArgs;
import com.pulumi.alicloud.rds.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 java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides an RDS connection resource to allocate an Internet connection string for RDS instance, see [What is DB Connection](https://www.alibabacloud.com/help/en/apsaradb-for-rds/latest/api-rds-2014-08-15-allocateinstancepublicconnection).
*
* > **NOTE:** Each RDS instance will allocate a intranet connnection string automatically and its prifix is RDS instance ID.
* To avoid unnecessary conflict, please specified a internet connection prefix before applying the resource.
*
* > **NOTE:** Available since v1.5.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.rds.RdsFunctions;
* import com.pulumi.alicloud.rds.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.rds.Instance;
* import com.pulumi.alicloud.rds.InstanceArgs;
* import com.pulumi.alicloud.rds.Connection;
* import com.pulumi.alicloud.rds.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("tf_example");
* final var default = RdsFunctions.getZones(GetZonesArgs.builder()
* .engine("MySQL")
* .engineVersion("5.6")
* .build());
*
* var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
* .vpcName(name)
* .cidrBlock("172.16.0.0/16")
* .build());
*
* var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
* .vpcId(defaultNetwork.id())
* .cidrBlock("172.16.0.0/24")
* .zoneId(default_.zones()[0].id())
* .vswitchName(name)
* .build());
*
* var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
* .engine("MySQL")
* .engineVersion("5.6")
* .instanceType("rds.mysql.t1.small")
* .instanceStorage("10")
* .vswitchId(defaultSwitch.id())
* .instanceName(name)
* .build());
*
* var defaultConnection = new Connection("defaultConnection", ConnectionArgs.builder()
* .instanceId(defaultInstance.id())
* .connectionPrefix("testabc")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* RDS connection can be imported using the id, e.g.
*
* ```sh
* $ pulumi import alicloud:rds/connection:Connection example abc12345678
* ```
*
*/
@ResourceType(type="alicloud:rds/connection:Connection")
public class Connection extends com.pulumi.resources.CustomResource {
/**
* The Tabular Data Stream (TDS) port of the instance for which Babelfish is enabled.
*
* > **NOTE:** This parameter applies only to ApsaraDB RDS for PostgreSQL instances. For more information about Babelfish for ApsaraDB RDS for PostgreSQL, see [Introduction to Babelfish](https://www.alibabacloud.com/help/en/apsaradb-for-rds/latest/babelfish-for-pg).
*
*/
@Export(name="babelfishPort", refs={String.class}, tree="[0]")
private Output babelfishPort;
/**
* @return The Tabular Data Stream (TDS) port of the instance for which Babelfish is enabled.
*
* > **NOTE:** This parameter applies only to ApsaraDB RDS for PostgreSQL instances. For more information about Babelfish for ApsaraDB RDS for PostgreSQL, see [Introduction to Babelfish](https://www.alibabacloud.com/help/en/apsaradb-for-rds/latest/babelfish-for-pg).
*
*/
public Output babelfishPort() {
return this.babelfishPort;
}
/**
* Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 40 characters. Default to <instance_id> + 'tf'.
*
*/
@Export(name="connectionPrefix", refs={String.class}, tree="[0]")
private Output connectionPrefix;
/**
* @return Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 40 characters. Default to <instance_id> + 'tf'.
*
*/
public Output connectionPrefix() {
return this.connectionPrefix;
}
/**
* Connection instance string.
*
*/
@Export(name="connectionString", refs={String.class}, tree="[0]")
private Output connectionString;
/**
* @return Connection instance string.
*
*/
public Output connectionString() {
return this.connectionString;
}
/**
* The Id of instance that can run database.
*
*/
@Export(name="instanceId", refs={String.class}, tree="[0]")
private Output instanceId;
/**
* @return The Id of instance that can run database.
*
*/
public Output instanceId() {
return this.instanceId;
}
/**
* 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;
}
/**
* Internet connection port. Valid value: [1000-5999]. Default to 3306.
*
*/
@Export(name="port", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> port;
/**
* @return Internet connection port. Valid value: [1000-5999]. Default to 3306.
*
*/
public Output> port() {
return Codegen.optional(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:rds/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:rds/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);
}
}