com.pulumi.gcp.databasemigrationservice.kotlin.PrivateConnection.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.databasemigrationservice.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.databasemigrationservice.kotlin.outputs.PrivateConnectionError
import com.pulumi.gcp.databasemigrationservice.kotlin.outputs.PrivateConnectionVpcPeeringConfig
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.databasemigrationservice.kotlin.outputs.PrivateConnectionError.Companion.toKotlin as privateConnectionErrorToKotlin
import com.pulumi.gcp.databasemigrationservice.kotlin.outputs.PrivateConnectionVpcPeeringConfig.Companion.toKotlin as privateConnectionVpcPeeringConfigToKotlin
/**
* Builder for [PrivateConnection].
*/
@PulumiTagMarker
public class PrivateConnectionResourceBuilder internal constructor() {
public var name: String? = null
public var args: PrivateConnectionArgs = PrivateConnectionArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend PrivateConnectionArgsBuilder.() -> Unit) {
val builder = PrivateConnectionArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): PrivateConnection {
val builtJavaResource =
com.pulumi.gcp.databasemigrationservice.PrivateConnection(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return PrivateConnection(builtJavaResource)
}
}
/**
* The PrivateConnection resource is used to establish private connectivity between Database Migration Service and a customer's network.
* To get more information about PrivateConnection, see:
* * [API documentation](https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.privateConnections)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/database-migration/docs/oracle-to-postgresql/create-private-connectivity-configuration)
* ## Example Usage
* ### Database Migration Service Private Connection
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const default = gcp.compute.getNetwork({
* name: "my-network",
* });
* const defaultPrivateConnection = new gcp.databasemigrationservice.PrivateConnection("default", {
* displayName: "dbms_pc",
* location: "us-central1",
* privateConnectionId: "my-connection",
* labels: {
* key: "value",
* },
* vpcPeeringConfig: {
* vpcName: _default.then(_default => _default.id),
* subnet: "10.0.0.0/29",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.get_network(name="my-network")
* default_private_connection = gcp.databasemigrationservice.PrivateConnection("default",
* display_name="dbms_pc",
* location="us-central1",
* private_connection_id="my-connection",
* labels={
* "key": "value",
* },
* vpc_peering_config=gcp.databasemigrationservice.PrivateConnectionVpcPeeringConfigArgs(
* vpc_name=default.id,
* subnet="10.0.0.0/29",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = Gcp.Compute.GetNetwork.Invoke(new()
* {
* Name = "my-network",
* });
* var defaultPrivateConnection = new Gcp.DatabaseMigrationService.PrivateConnection("default", new()
* {
* DisplayName = "dbms_pc",
* Location = "us-central1",
* PrivateConnectionId = "my-connection",
* Labels =
* {
* { "key", "value" },
* },
* VpcPeeringConfig = new Gcp.DatabaseMigrationService.Inputs.PrivateConnectionVpcPeeringConfigArgs
* {
* VpcName = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
* Subnet = "10.0.0.0/29",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/databasemigrationservice"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _default, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
* Name: "my-network",
* }, nil)
* if err != nil {
* return err
* }
* _, err = databasemigrationservice.NewPrivateConnection(ctx, "default", &databasemigrationservice.PrivateConnectionArgs{
* DisplayName: pulumi.String("dbms_pc"),
* Location: pulumi.String("us-central1"),
* PrivateConnectionId: pulumi.String("my-connection"),
* Labels: pulumi.StringMap{
* "key": pulumi.String("value"),
* },
* VpcPeeringConfig: &databasemigrationservice.PrivateConnectionVpcPeeringConfigArgs{
* VpcName: pulumi.String(_default.Id),
* Subnet: pulumi.String("10.0.0.0/29"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.ComputeFunctions;
* import com.pulumi.gcp.compute.inputs.GetNetworkArgs;
* import com.pulumi.gcp.databasemigrationservice.PrivateConnection;
* import com.pulumi.gcp.databasemigrationservice.PrivateConnectionArgs;
* import com.pulumi.gcp.databasemigrationservice.inputs.PrivateConnectionVpcPeeringConfigArgs;
* 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 = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
* .name("my-network")
* .build());
* var defaultPrivateConnection = new PrivateConnection("defaultPrivateConnection", PrivateConnectionArgs.builder()
* .displayName("dbms_pc")
* .location("us-central1")
* .privateConnectionId("my-connection")
* .labels(Map.of("key", "value"))
* .vpcPeeringConfig(PrivateConnectionVpcPeeringConfigArgs.builder()
* .vpcName(default_.id())
* .subnet("10.0.0.0/29")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* defaultPrivateConnection:
* type: gcp:databasemigrationservice:PrivateConnection
* name: default
* properties:
* displayName: dbms_pc
* location: us-central1
* privateConnectionId: my-connection
* labels:
* key: value
* vpcPeeringConfig:
* vpcName: ${default.id}
* subnet: 10.0.0.0/29
* variables:
* default:
* fn::invoke:
* Function: gcp:compute:getNetwork
* Arguments:
* name: my-network
* ```
*
* ## Import
* PrivateConnection can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}`
* * `{{project}}/{{location}}/{{private_connection_id}}`
* * `{{location}}/{{private_connection_id}}`
* When using the `pulumi import` command, PrivateConnection can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:databasemigrationservice/privateConnection:PrivateConnection default projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}
* ```
* ```sh
* $ pulumi import gcp:databasemigrationservice/privateConnection:PrivateConnection default {{project}}/{{location}}/{{private_connection_id}}
* ```
* ```sh
* $ pulumi import gcp:databasemigrationservice/privateConnection:PrivateConnection default {{location}}/{{private_connection_id}}
* ```
*/
public class PrivateConnection internal constructor(
override val javaResource: com.pulumi.gcp.databasemigrationservice.PrivateConnection,
) : KotlinCustomResource(javaResource, PrivateConnectionMapper) {
/**
* Display name.
*/
public val displayName: Output
get() = javaResource.displayName().applyValue({ args0 -> args0 })
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
public val effectiveLabels: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy