All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.networkconnectivity.kotlin.ServiceConnectionPolicyArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.networkconnectivity.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.networkconnectivity.ServiceConnectionPolicyArgs.builder
import com.pulumi.gcp.networkconnectivity.kotlin.inputs.ServiceConnectionPolicyPscConfigArgs
import com.pulumi.gcp.networkconnectivity.kotlin.inputs.ServiceConnectionPolicyPscConfigArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manage Service Connection Policies.
 * To get more information about ServiceConnectionPolicy, see:
 * * [API documentation](https://cloud.google.com/secure-web-proxy/docs/reference/networkconnectivity/rest/v1/projects.locations.networkConnectionPolicies)
 * * How-to Guides
 *     * [About Service Connection Policies](https://cloud.google.com/vpc/docs/about-service-connection-policies#service-policies)
 * ## Example Usage
 * ### Network Connectivity Policy Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const producerNet = new gcp.compute.Network("producer_net", {
 *     name: "producer-net",
 *     autoCreateSubnetworks: false,
 * });
 * const producerSubnet = new gcp.compute.Subnetwork("producer_subnet", {
 *     name: "producer-subnet",
 *     ipCidrRange: "10.0.0.0/16",
 *     region: "us-central1",
 *     network: producerNet.id,
 * });
 * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", {
 *     name: "my-network-connectivity-policy",
 *     location: "us-central1",
 *     serviceClass: "my-basic-service-class",
 *     description: "my basic service connection policy",
 *     network: producerNet.id,
 *     pscConfig: {
 *         subnetworks: [producerSubnet.id],
 *         limit: "2",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * producer_net = gcp.compute.Network("producer_net",
 *     name="producer-net",
 *     auto_create_subnetworks=False)
 * producer_subnet = gcp.compute.Subnetwork("producer_subnet",
 *     name="producer-subnet",
 *     ip_cidr_range="10.0.0.0/16",
 *     region="us-central1",
 *     network=producer_net.id)
 * default = gcp.networkconnectivity.ServiceConnectionPolicy("default",
 *     name="my-network-connectivity-policy",
 *     location="us-central1",
 *     service_class="my-basic-service-class",
 *     description="my basic service connection policy",
 *     network=producer_net.id,
 *     psc_config=gcp.networkconnectivity.ServiceConnectionPolicyPscConfigArgs(
 *         subnetworks=[producer_subnet.id],
 *         limit="2",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var producerNet = new Gcp.Compute.Network("producer_net", new()
 *     {
 *         Name = "producer-net",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var producerSubnet = new Gcp.Compute.Subnetwork("producer_subnet", new()
 *     {
 *         Name = "producer-subnet",
 *         IpCidrRange = "10.0.0.0/16",
 *         Region = "us-central1",
 *         Network = producerNet.Id,
 *     });
 *     var @default = new Gcp.NetworkConnectivity.ServiceConnectionPolicy("default", new()
 *     {
 *         Name = "my-network-connectivity-policy",
 *         Location = "us-central1",
 *         ServiceClass = "my-basic-service-class",
 *         Description = "my basic service connection policy",
 *         Network = producerNet.Id,
 *         PscConfig = new Gcp.NetworkConnectivity.Inputs.ServiceConnectionPolicyPscConfigArgs
 *         {
 *             Subnetworks = new[]
 *             {
 *                 producerSubnet.Id,
 *             },
 *             Limit = "2",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkconnectivity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		producerNet, err := compute.NewNetwork(ctx, "producer_net", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("producer-net"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		producerSubnet, err := compute.NewSubnetwork(ctx, "producer_subnet", &compute.SubnetworkArgs{
 * 			Name:        pulumi.String("producer-subnet"),
 * 			IpCidrRange: pulumi.String("10.0.0.0/16"),
 * 			Region:      pulumi.String("us-central1"),
 * 			Network:     producerNet.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkconnectivity.NewServiceConnectionPolicy(ctx, "default", &networkconnectivity.ServiceConnectionPolicyArgs{
 * 			Name:         pulumi.String("my-network-connectivity-policy"),
 * 			Location:     pulumi.String("us-central1"),
 * 			ServiceClass: pulumi.String("my-basic-service-class"),
 * 			Description:  pulumi.String("my basic service connection policy"),
 * 			Network:      producerNet.ID(),
 * 			PscConfig: &networkconnectivity.ServiceConnectionPolicyPscConfigArgs{
 * 				Subnetworks: pulumi.StringArray{
 * 					producerSubnet.ID(),
 * 				},
 * 				Limit: pulumi.String("2"),
 * 			},
 * 		})
 * 		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.Subnetwork;
 * import com.pulumi.gcp.compute.SubnetworkArgs;
 * import com.pulumi.gcp.networkconnectivity.ServiceConnectionPolicy;
 * import com.pulumi.gcp.networkconnectivity.ServiceConnectionPolicyArgs;
 * import com.pulumi.gcp.networkconnectivity.inputs.ServiceConnectionPolicyPscConfigArgs;
 * 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) {
 *         var producerNet = new Network("producerNet", NetworkArgs.builder()
 *             .name("producer-net")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var producerSubnet = new Subnetwork("producerSubnet", SubnetworkArgs.builder()
 *             .name("producer-subnet")
 *             .ipCidrRange("10.0.0.0/16")
 *             .region("us-central1")
 *             .network(producerNet.id())
 *             .build());
 *         var default_ = new ServiceConnectionPolicy("default", ServiceConnectionPolicyArgs.builder()
 *             .name("my-network-connectivity-policy")
 *             .location("us-central1")
 *             .serviceClass("my-basic-service-class")
 *             .description("my basic service connection policy")
 *             .network(producerNet.id())
 *             .pscConfig(ServiceConnectionPolicyPscConfigArgs.builder()
 *                 .subnetworks(producerSubnet.id())
 *                 .limit(2)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   producerNet:
 *     type: gcp:compute:Network
 *     name: producer_net
 *     properties:
 *       name: producer-net
 *       autoCreateSubnetworks: false
 *   producerSubnet:
 *     type: gcp:compute:Subnetwork
 *     name: producer_subnet
 *     properties:
 *       name: producer-subnet
 *       ipCidrRange: 10.0.0.0/16
 *       region: us-central1
 *       network: ${producerNet.id}
 *   default:
 *     type: gcp:networkconnectivity:ServiceConnectionPolicy
 *     properties:
 *       name: my-network-connectivity-policy
 *       location: us-central1
 *       serviceClass: my-basic-service-class
 *       description: my basic service connection policy
 *       network: ${producerNet.id}
 *       pscConfig:
 *         subnetworks:
 *           - ${producerSubnet.id}
 *         limit: 2
 * ```
 * 
 * ## Import
 * ServiceConnectionPolicy can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/serviceConnectionPolicies/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, ServiceConnectionPolicy can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:networkconnectivity/serviceConnectionPolicy:ServiceConnectionPolicy default projects/{{project}}/locations/{{location}}/serviceConnectionPolicies/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networkconnectivity/serviceConnectionPolicy:ServiceConnectionPolicy default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networkconnectivity/serviceConnectionPolicy:ServiceConnectionPolicy default {{location}}/{{name}}
 * ```
 * @property description Free-text description of the resource.
 * @property labels User-defined labels.
 * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
 * Please refer to the field `effective_labels` for all of the labels present on the resource.
 * @property location The location of the ServiceConnectionPolicy.
 * - - -
 * @property name The name of a ServiceConnectionPolicy. Format: projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy} See: https://google.aip.dev/122#fields-representing-resource-names
 * @property network The resource path of the consumer network. Example: - projects/{projectNumOrId}/global/networks/{resourceId}.
 * @property project The ID of the project in which the resource belongs.
 * If it is not provided, the provider project is used.
 * @property pscConfig Configuration used for Private Service Connect connections. Used when Infrastructure is PSC.
 * Structure is documented below.
 * @property serviceClass The service class identifier for which this ServiceConnectionPolicy is for. The service class identifier is a unique, symbolic representation of a ServiceClass.
 * It is provided by the Service Producer. Google services have a prefix of gcp. For example, gcp-cloud-sql. 3rd party services do not. For example, test-service-a3dfcx.
 */
public data class ServiceConnectionPolicyArgs(
    public val description: Output? = null,
    public val labels: Output>? = null,
    public val location: Output? = null,
    public val name: Output? = null,
    public val network: Output? = null,
    public val project: Output? = null,
    public val pscConfig: Output? = null,
    public val serviceClass: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.networkconnectivity.ServiceConnectionPolicyArgs =
        com.pulumi.gcp.networkconnectivity.ServiceConnectionPolicyArgs.builder()
            .description(description?.applyValue({ args0 -> args0 }))
            .labels(labels?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .location(location?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .network(network?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .pscConfig(pscConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .serviceClass(serviceClass?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [ServiceConnectionPolicyArgs].
 */
@PulumiTagMarker
public class ServiceConnectionPolicyArgsBuilder internal constructor() {
    private var description: Output? = null

    private var labels: Output>? = null

    private var location: Output? = null

    private var name: Output? = null

    private var network: Output? = null

    private var project: Output? = null

    private var pscConfig: Output? = null

    private var serviceClass: Output? = null

    /**
     * @param value Free-text description of the resource.
     */
    @JvmName("figlpoqtxkhoxkvj")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value User-defined labels.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    @JvmName("bfvccsshlrwbjilj")
    public suspend fun labels(`value`: Output>) {
        this.labels = value
    }

    /**
     * @param value The location of the ServiceConnectionPolicy.
     * - - -
     */
    @JvmName("jhtsxmqocnxymjhl")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value The name of a ServiceConnectionPolicy. Format: projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy} See: https://google.aip.dev/122#fields-representing-resource-names
     */
    @JvmName("cmqerqcsepvjvnio")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The resource path of the consumer network. Example: - projects/{projectNumOrId}/global/networks/{resourceId}.
     */
    @JvmName("iuhdvbckrbfsbohx")
    public suspend fun network(`value`: Output) {
        this.network = value
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("moshhkneqffrdshc")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value Configuration used for Private Service Connect connections. Used when Infrastructure is PSC.
     * Structure is documented below.
     */
    @JvmName("nwodtllqxpgsyoup")
    public suspend fun pscConfig(`value`: Output) {
        this.pscConfig = value
    }

    /**
     * @param value The service class identifier for which this ServiceConnectionPolicy is for. The service class identifier is a unique, symbolic representation of a ServiceClass.
     * It is provided by the Service Producer. Google services have a prefix of gcp. For example, gcp-cloud-sql. 3rd party services do not. For example, test-service-a3dfcx.
     */
    @JvmName("jxgpiyjmebpnoort")
    public suspend fun serviceClass(`value`: Output) {
        this.serviceClass = value
    }

    /**
     * @param value Free-text description of the resource.
     */
    @JvmName("jkgrdklkodtkdwtl")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value User-defined labels.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    @JvmName("eaxuhmcnkwtjchxi")
    public suspend fun labels(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param values User-defined labels.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    @JvmName("skdeobsvcsshvcml")
    public fun labels(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param value The location of the ServiceConnectionPolicy.
     * - - -
     */
    @JvmName("smroevfcsvaoslip")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value The name of a ServiceConnectionPolicy. Format: projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy} See: https://google.aip.dev/122#fields-representing-resource-names
     */
    @JvmName("nixwtgaigendvnlp")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The resource path of the consumer network. Example: - projects/{projectNumOrId}/global/networks/{resourceId}.
     */
    @JvmName("bvjqnwobkgcdygjv")
    public suspend fun network(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.network = mapped
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("ttdbomgmoldvflrp")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value Configuration used for Private Service Connect connections. Used when Infrastructure is PSC.
     * Structure is documented below.
     */
    @JvmName("kbcysyiacrtyuwhn")
    public suspend fun pscConfig(`value`: ServiceConnectionPolicyPscConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.pscConfig = mapped
    }

    /**
     * @param argument Configuration used for Private Service Connect connections. Used when Infrastructure is PSC.
     * Structure is documented below.
     */
    @JvmName("ofuoeejmnwcvoxxb")
    public suspend fun pscConfig(argument: suspend ServiceConnectionPolicyPscConfigArgsBuilder.() -> Unit) {
        val toBeMapped = ServiceConnectionPolicyPscConfigArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.pscConfig = mapped
    }

    /**
     * @param value The service class identifier for which this ServiceConnectionPolicy is for. The service class identifier is a unique, symbolic representation of a ServiceClass.
     * It is provided by the Service Producer. Google services have a prefix of gcp. For example, gcp-cloud-sql. 3rd party services do not. For example, test-service-a3dfcx.
     */
    @JvmName("ysfgyiflktdxsxap")
    public suspend fun serviceClass(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.serviceClass = mapped
    }

    internal fun build(): ServiceConnectionPolicyArgs = ServiceConnectionPolicyArgs(
        description = description,
        labels = labels,
        location = location,
        name = name,
        network = network,
        project = project,
        pscConfig = pscConfig,
        serviceClass = serviceClass,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy