Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.servicenetworking.kotlin.ConnectionArgs.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.servicenetworking.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.servicenetworking.ConnectionArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* Manages a private VPC connection with a GCP service provider. For more information see
* [the official documentation](https://cloud.google.com/vpc/docs/configure-private-services-access#creating-connection)
* and
* [API](https://cloud.google.com/service-infrastructure/docs/service-networking/reference/rest/v1/services.connections).
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* // Create a VPC network
* const peeringNetwork = new gcp.compute.Network("peering_network", {name: "peering-network"});
* // Create an IP address
* const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
* name: "private-ip-alloc",
* purpose: "VPC_PEERING",
* addressType: "INTERNAL",
* prefixLength: 16,
* network: peeringNetwork.id,
* });
* // Create a private connection
* const _default = new gcp.servicenetworking.Connection("default", {
* network: peeringNetwork.id,
* service: "servicenetworking.googleapis.com",
* reservedPeeringRanges: [privateIpAlloc.name],
* });
* // (Optional) Import or export custom routes
* const peeringRoutes = new gcp.compute.NetworkPeeringRoutesConfig("peering_routes", {
* peering: _default.peering,
* network: peeringNetwork.name,
* importCustomRoutes: true,
* exportCustomRoutes: true,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* # Create a VPC network
* peering_network = gcp.compute.Network("peering_network", name="peering-network")
* # Create an IP address
* private_ip_alloc = gcp.compute.GlobalAddress("private_ip_alloc",
* name="private-ip-alloc",
* purpose="VPC_PEERING",
* address_type="INTERNAL",
* prefix_length=16,
* network=peering_network.id)
* # Create a private connection
* default = gcp.servicenetworking.Connection("default",
* network=peering_network.id,
* service="servicenetworking.googleapis.com",
* reserved_peering_ranges=[private_ip_alloc.name])
* # (Optional) Import or export custom routes
* peering_routes = gcp.compute.NetworkPeeringRoutesConfig("peering_routes",
* peering=default.peering,
* network=peering_network.name,
* import_custom_routes=True,
* export_custom_routes=True)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* // Create a VPC network
* var peeringNetwork = new Gcp.Compute.Network("peering_network", new()
* {
* Name = "peering-network",
* });
* // Create an IP address
* var privateIpAlloc = new Gcp.Compute.GlobalAddress("private_ip_alloc", new()
* {
* Name = "private-ip-alloc",
* Purpose = "VPC_PEERING",
* AddressType = "INTERNAL",
* PrefixLength = 16,
* Network = peeringNetwork.Id,
* });
* // Create a private connection
* var @default = new Gcp.ServiceNetworking.Connection("default", new()
* {
* Network = peeringNetwork.Id,
* Service = "servicenetworking.googleapis.com",
* ReservedPeeringRanges = new[]
* {
* privateIpAlloc.Name,
* },
* });
* // (Optional) Import or export custom routes
* var peeringRoutes = new Gcp.Compute.NetworkPeeringRoutesConfig("peering_routes", new()
* {
* Peering = @default.Peering,
* Network = peeringNetwork.Name,
* ImportCustomRoutes = true,
* ExportCustomRoutes = true,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* // Create a VPC network
* peeringNetwork, err := compute.NewNetwork(ctx, "peering_network", &compute.NetworkArgs{
* Name: pulumi.String("peering-network"),
* })
* if err != nil {
* return err
* }
* // Create an IP address
* privateIpAlloc, err := compute.NewGlobalAddress(ctx, "private_ip_alloc", &compute.GlobalAddressArgs{
* Name: pulumi.String("private-ip-alloc"),
* Purpose: pulumi.String("VPC_PEERING"),
* AddressType: pulumi.String("INTERNAL"),
* PrefixLength: pulumi.Int(16),
* Network: peeringNetwork.ID(),
* })
* if err != nil {
* return err
* }
* // Create a private connection
* _, err = servicenetworking.NewConnection(ctx, "default", &servicenetworking.ConnectionArgs{
* Network: peeringNetwork.ID(),
* Service: pulumi.String("servicenetworking.googleapis.com"),
* ReservedPeeringRanges: pulumi.StringArray{
* privateIpAlloc.Name,
* },
* })
* if err != nil {
* return err
* }
* // (Optional) Import or export custom routes
* _, err = compute.NewNetworkPeeringRoutesConfig(ctx, "peering_routes", &compute.NetworkPeeringRoutesConfigArgs{
* Peering: _default.Peering,
* Network: peeringNetwork.Name,
* ImportCustomRoutes: pulumi.Bool(true),
* ExportCustomRoutes: pulumi.Bool(true),
* })
* 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.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.GlobalAddress;
* import com.pulumi.gcp.compute.GlobalAddressArgs;
* import com.pulumi.gcp.servicenetworking.Connection;
* import com.pulumi.gcp.servicenetworking.ConnectionArgs;
* import com.pulumi.gcp.compute.NetworkPeeringRoutesConfig;
* import com.pulumi.gcp.compute.NetworkPeeringRoutesConfigArgs;
* 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) {
* // Create a VPC network
* var peeringNetwork = new Network("peeringNetwork", NetworkArgs.builder()
* .name("peering-network")
* .build());
* // Create an IP address
* var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
* .name("private-ip-alloc")
* .purpose("VPC_PEERING")
* .addressType("INTERNAL")
* .prefixLength(16)
* .network(peeringNetwork.id())
* .build());
* // Create a private connection
* var default_ = new Connection("default", ConnectionArgs.builder()
* .network(peeringNetwork.id())
* .service("servicenetworking.googleapis.com")
* .reservedPeeringRanges(privateIpAlloc.name())
* .build());
* // (Optional) Import or export custom routes
* var peeringRoutes = new NetworkPeeringRoutesConfig("peeringRoutes", NetworkPeeringRoutesConfigArgs.builder()
* .peering(default_.peering())
* .network(peeringNetwork.name())
* .importCustomRoutes(true)
* .exportCustomRoutes(true)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* # Create a VPC network
* peeringNetwork:
* type: gcp:compute:Network
* name: peering_network
* properties:
* name: peering-network
* # Create an IP address
* privateIpAlloc:
* type: gcp:compute:GlobalAddress
* name: private_ip_alloc
* properties:
* name: private-ip-alloc
* purpose: VPC_PEERING
* addressType: INTERNAL
* prefixLength: 16
* network: ${peeringNetwork.id}
* # Create a private connection
* default:
* type: gcp:servicenetworking:Connection
* properties:
* network: ${peeringNetwork.id}
* service: servicenetworking.googleapis.com
* reservedPeeringRanges:
* - ${privateIpAlloc.name}
* # (Optional) Import or export custom routes
* peeringRoutes:
* type: gcp:compute:NetworkPeeringRoutesConfig
* name: peering_routes
* properties:
* peering: ${default.peering}
* network: ${peeringNetwork.name}
* importCustomRoutes: true
* exportCustomRoutes: true
* ```
*
* ## Import
* ServiceNetworkingConnection can be imported using any of these accepted formats
* * `{{peering-network}}:{{service}}`
* * `projects/{{project}}/global/networks/{{peering-network}}:{{service}}`
* When using the `pulumi import` command, NAME_HERE can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:servicenetworking/connection:Connection default {{peering-network}}:{{service}}
* ```
* ```sh
* $ pulumi import gcp:servicenetworking/connection:Connection default /projects/{{project}}/global/networks/{{peering-network}}:{{service}}
* ```
* @property deletionPolicy
* @property network Name of VPC network connected with service producers using VPC peering.
* @property reservedPeeringRanges Named IP address range(s) of PEERING type reserved for
* this service provider. Note that invoking this method with a different range when connection
* is already established will not reallocate already provisioned service producer subnetworks.
* @property service Provider peering service that is managing peering connectivity for a
* service provider organization. For Google services that support this functionality it is
* 'servicenetworking.googleapis.com'.
* @property updateOnCreationFail When set to true, enforce an update of the reserved peering ranges on the existing service networking connection in case of a new connection creation failure.
*/
public data class ConnectionArgs(
public val deletionPolicy: Output? = null,
public val network: Output? = null,
public val reservedPeeringRanges: Output>? = null,
public val service: Output? = null,
public val updateOnCreationFail: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.servicenetworking.ConnectionArgs =
com.pulumi.gcp.servicenetworking.ConnectionArgs.builder()
.deletionPolicy(deletionPolicy?.applyValue({ args0 -> args0 }))
.network(network?.applyValue({ args0 -> args0 }))
.reservedPeeringRanges(reservedPeeringRanges?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.service(service?.applyValue({ args0 -> args0 }))
.updateOnCreationFail(updateOnCreationFail?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [ConnectionArgs].
*/
@PulumiTagMarker
public class ConnectionArgsBuilder internal constructor() {
private var deletionPolicy: Output? = null
private var network: Output? = null
private var reservedPeeringRanges: Output>? = null
private var service: Output? = null
private var updateOnCreationFail: Output? = null
/**
* @param value
*/
@JvmName("fmmhadsvkbhqlbmv")
public suspend fun deletionPolicy(`value`: Output) {
this.deletionPolicy = value
}
/**
* @param value Name of VPC network connected with service producers using VPC peering.
*/
@JvmName("cxyerbmnnutcixjg")
public suspend fun network(`value`: Output) {
this.network = value
}
/**
* @param value Named IP address range(s) of PEERING type reserved for
* this service provider. Note that invoking this method with a different range when connection
* is already established will not reallocate already provisioned service producer subnetworks.
*/
@JvmName("xdutcacruketlnej")
public suspend fun reservedPeeringRanges(`value`: Output>) {
this.reservedPeeringRanges = value
}
@JvmName("mqkwechvpbuhkfie")
public suspend fun reservedPeeringRanges(vararg values: Output) {
this.reservedPeeringRanges = Output.all(values.asList())
}
/**
* @param values Named IP address range(s) of PEERING type reserved for
* this service provider. Note that invoking this method with a different range when connection
* is already established will not reallocate already provisioned service producer subnetworks.
*/
@JvmName("bxpaoieiacsharwj")
public suspend fun reservedPeeringRanges(values: List>) {
this.reservedPeeringRanges = Output.all(values)
}
/**
* @param value Provider peering service that is managing peering connectivity for a
* service provider organization. For Google services that support this functionality it is
* 'servicenetworking.googleapis.com'.
*/
@JvmName("plqkacfbvbwuxoyo")
public suspend fun service(`value`: Output) {
this.service = value
}
/**
* @param value When set to true, enforce an update of the reserved peering ranges on the existing service networking connection in case of a new connection creation failure.
*/
@JvmName("hualfrdlpmuuxlnx")
public suspend fun updateOnCreationFail(`value`: Output) {
this.updateOnCreationFail = value
}
/**
* @param value
*/
@JvmName("pcvyljsgtmyitand")
public suspend fun deletionPolicy(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.deletionPolicy = mapped
}
/**
* @param value Name of VPC network connected with service producers using VPC peering.
*/
@JvmName("whdpvyqguscgsnjs")
public suspend fun network(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.network = mapped
}
/**
* @param value Named IP address range(s) of PEERING type reserved for
* this service provider. Note that invoking this method with a different range when connection
* is already established will not reallocate already provisioned service producer subnetworks.
*/
@JvmName("ppyudauwlnyjkmyj")
public suspend fun reservedPeeringRanges(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.reservedPeeringRanges = mapped
}
/**
* @param values Named IP address range(s) of PEERING type reserved for
* this service provider. Note that invoking this method with a different range when connection
* is already established will not reallocate already provisioned service producer subnetworks.
*/
@JvmName("ernnobuomidgpdbg")
public suspend fun reservedPeeringRanges(vararg values: String) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.reservedPeeringRanges = mapped
}
/**
* @param value Provider peering service that is managing peering connectivity for a
* service provider organization. For Google services that support this functionality it is
* 'servicenetworking.googleapis.com'.
*/
@JvmName("hlfhyvnldaboaydv")
public suspend fun service(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.service = mapped
}
/**
* @param value When set to true, enforce an update of the reserved peering ranges on the existing service networking connection in case of a new connection creation failure.
*/
@JvmName("aybsitmvglvngwpm")
public suspend fun updateOnCreationFail(`value`: Boolean?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.updateOnCreationFail = mapped
}
internal fun build(): ConnectionArgs = ConnectionArgs(
deletionPolicy = deletionPolicy,
network = network,
reservedPeeringRanges = reservedPeeringRanges,
service = service,
updateOnCreationFail = updateOnCreationFail,
)
}