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

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

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.networkconnectivity.kotlin

import com.pulumi.core.Output
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.Map

/**
 * Builder for [RegionalEndpoint].
 */
@PulumiTagMarker
public class RegionalEndpointResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: RegionalEndpointArgs = RegionalEndpointArgs()

    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 RegionalEndpointArgsBuilder.() -> Unit) {
        val builder = RegionalEndpointArgsBuilder()
        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(): RegionalEndpoint {
        val builtJavaResource =
            com.pulumi.gcp.networkconnectivity.RegionalEndpoint(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return RegionalEndpoint(builtJavaResource)
    }
}

/**
 * Regional Private Service Connect (PSC) endpoint resource.
 * To get more information about RegionalEndpoint, see:
 * * [API documentation](https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest/v1/projects.locations.regionalEndpoints)
 * * How-to Guides
 *     * [Access regional Google APIs through endpoints](https://cloud.google.com/vpc/docs/access-regional-google-apis-endpoints)
 * ## Example Usage
 * ### Network Connectivity Regional Endpoint Regional Access
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const myNetwork = new gcp.compute.Network("my_network", {
 *     name: "my-network",
 *     autoCreateSubnetworks: false,
 * });
 * const mySubnetwork = new gcp.compute.Subnetwork("my_subnetwork", {
 *     name: "my-subnetwork",
 *     ipCidrRange: "192.168.0.0/24",
 *     region: "us-central1",
 *     network: myNetwork.id,
 * });
 * const _default = new gcp.networkconnectivity.RegionalEndpoint("default", {
 *     name: "my-rep",
 *     location: "us-central1",
 *     targetGoogleApi: "storage.us-central1.p.rep.googleapis.com",
 *     accessType: "REGIONAL",
 *     address: "192.168.0.5",
 *     network: myNetwork.id,
 *     subnetwork: mySubnetwork.id,
 *     description: "My RegionalEndpoint targeting Google API storage.us-central1.p.rep.googleapis.com",
 *     labels: {
 *         env: "default",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * my_network = gcp.compute.Network("my_network",
 *     name="my-network",
 *     auto_create_subnetworks=False)
 * my_subnetwork = gcp.compute.Subnetwork("my_subnetwork",
 *     name="my-subnetwork",
 *     ip_cidr_range="192.168.0.0/24",
 *     region="us-central1",
 *     network=my_network.id)
 * default = gcp.networkconnectivity.RegionalEndpoint("default",
 *     name="my-rep",
 *     location="us-central1",
 *     target_google_api="storage.us-central1.p.rep.googleapis.com",
 *     access_type="REGIONAL",
 *     address="192.168.0.5",
 *     network=my_network.id,
 *     subnetwork=my_subnetwork.id,
 *     description="My RegionalEndpoint targeting Google API storage.us-central1.p.rep.googleapis.com",
 *     labels={
 *         "env": "default",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var myNetwork = new Gcp.Compute.Network("my_network", new()
 *     {
 *         Name = "my-network",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var mySubnetwork = new Gcp.Compute.Subnetwork("my_subnetwork", new()
 *     {
 *         Name = "my-subnetwork",
 *         IpCidrRange = "192.168.0.0/24",
 *         Region = "us-central1",
 *         Network = myNetwork.Id,
 *     });
 *     var @default = new Gcp.NetworkConnectivity.RegionalEndpoint("default", new()
 *     {
 *         Name = "my-rep",
 *         Location = "us-central1",
 *         TargetGoogleApi = "storage.us-central1.p.rep.googleapis.com",
 *         AccessType = "REGIONAL",
 *         Address = "192.168.0.5",
 *         Network = myNetwork.Id,
 *         Subnetwork = mySubnetwork.Id,
 *         Description = "My RegionalEndpoint targeting Google API storage.us-central1.p.rep.googleapis.com",
 *         Labels =
 *         {
 *             { "env", "default" },
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		myNetwork, err := compute.NewNetwork(ctx, "my_network", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("my-network"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		mySubnetwork, err := compute.NewSubnetwork(ctx, "my_subnetwork", &compute.SubnetworkArgs{
 * 			Name:        pulumi.String("my-subnetwork"),
 * 			IpCidrRange: pulumi.String("192.168.0.0/24"),
 * 			Region:      pulumi.String("us-central1"),
 * 			Network:     myNetwork.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkconnectivity.NewRegionalEndpoint(ctx, "default", &networkconnectivity.RegionalEndpointArgs{
 * 			Name:            pulumi.String("my-rep"),
 * 			Location:        pulumi.String("us-central1"),
 * 			TargetGoogleApi: pulumi.String("storage.us-central1.p.rep.googleapis.com"),
 * 			AccessType:      pulumi.String("REGIONAL"),
 * 			Address:         pulumi.String("192.168.0.5"),
 * 			Network:         myNetwork.ID(),
 * 			Subnetwork:      mySubnetwork.ID(),
 * 			Description:     pulumi.String("My RegionalEndpoint targeting Google API storage.us-central1.p.rep.googleapis.com"),
 * 			Labels: pulumi.StringMap{
 * 				"env": pulumi.String("default"),
 * 			},
 * 		})
 * 		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.RegionalEndpoint;
 * import com.pulumi.gcp.networkconnectivity.RegionalEndpointArgs;
 * 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 myNetwork = new Network("myNetwork", NetworkArgs.builder()
 *             .name("my-network")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var mySubnetwork = new Subnetwork("mySubnetwork", SubnetworkArgs.builder()
 *             .name("my-subnetwork")
 *             .ipCidrRange("192.168.0.0/24")
 *             .region("us-central1")
 *             .network(myNetwork.id())
 *             .build());
 *         var default_ = new RegionalEndpoint("default", RegionalEndpointArgs.builder()
 *             .name("my-rep")
 *             .location("us-central1")
 *             .targetGoogleApi("storage.us-central1.p.rep.googleapis.com")
 *             .accessType("REGIONAL")
 *             .address("192.168.0.5")
 *             .network(myNetwork.id())
 *             .subnetwork(mySubnetwork.id())
 *             .description("My RegionalEndpoint targeting Google API storage.us-central1.p.rep.googleapis.com")
 *             .labels(Map.of("env", "default"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   myNetwork:
 *     type: gcp:compute:Network
 *     name: my_network
 *     properties:
 *       name: my-network
 *       autoCreateSubnetworks: false
 *   mySubnetwork:
 *     type: gcp:compute:Subnetwork
 *     name: my_subnetwork
 *     properties:
 *       name: my-subnetwork
 *       ipCidrRange: 192.168.0.0/24
 *       region: us-central1
 *       network: ${myNetwork.id}
 *   default:
 *     type: gcp:networkconnectivity:RegionalEndpoint
 *     properties:
 *       name: my-rep
 *       location: us-central1
 *       targetGoogleApi: storage.us-central1.p.rep.googleapis.com
 *       accessType: REGIONAL
 *       address: 192.168.0.5
 *       network: ${myNetwork.id}
 *       subnetwork: ${mySubnetwork.id}
 *       description: My RegionalEndpoint targeting Google API storage.us-central1.p.rep.googleapis.com
 *       labels:
 *         env: default
 * ```
 * 
 * ### Network Connectivity Regional Endpoint Global Access
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const myNetwork = new gcp.compute.Network("my_network", {
 *     name: "my-network",
 *     autoCreateSubnetworks: false,
 * });
 * const mySubnetwork = new gcp.compute.Subnetwork("my_subnetwork", {
 *     name: "my-subnetwork",
 *     ipCidrRange: "192.168.0.0/24",
 *     region: "us-central1",
 *     network: myNetwork.id,
 * });
 * const _default = new gcp.networkconnectivity.RegionalEndpoint("default", {
 *     name: "my-rep",
 *     location: "us-central1",
 *     targetGoogleApi: "storage.us-central1.p.rep.googleapis.com",
 *     accessType: "GLOBAL",
 *     address: "192.168.0.4",
 *     network: myNetwork.id,
 *     subnetwork: mySubnetwork.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * my_network = gcp.compute.Network("my_network",
 *     name="my-network",
 *     auto_create_subnetworks=False)
 * my_subnetwork = gcp.compute.Subnetwork("my_subnetwork",
 *     name="my-subnetwork",
 *     ip_cidr_range="192.168.0.0/24",
 *     region="us-central1",
 *     network=my_network.id)
 * default = gcp.networkconnectivity.RegionalEndpoint("default",
 *     name="my-rep",
 *     location="us-central1",
 *     target_google_api="storage.us-central1.p.rep.googleapis.com",
 *     access_type="GLOBAL",
 *     address="192.168.0.4",
 *     network=my_network.id,
 *     subnetwork=my_subnetwork.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var myNetwork = new Gcp.Compute.Network("my_network", new()
 *     {
 *         Name = "my-network",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var mySubnetwork = new Gcp.Compute.Subnetwork("my_subnetwork", new()
 *     {
 *         Name = "my-subnetwork",
 *         IpCidrRange = "192.168.0.0/24",
 *         Region = "us-central1",
 *         Network = myNetwork.Id,
 *     });
 *     var @default = new Gcp.NetworkConnectivity.RegionalEndpoint("default", new()
 *     {
 *         Name = "my-rep",
 *         Location = "us-central1",
 *         TargetGoogleApi = "storage.us-central1.p.rep.googleapis.com",
 *         AccessType = "GLOBAL",
 *         Address = "192.168.0.4",
 *         Network = myNetwork.Id,
 *         Subnetwork = mySubnetwork.Id,
 *     });
 * });
 * ```
 * ```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 {
 * 		myNetwork, err := compute.NewNetwork(ctx, "my_network", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("my-network"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		mySubnetwork, err := compute.NewSubnetwork(ctx, "my_subnetwork", &compute.SubnetworkArgs{
 * 			Name:        pulumi.String("my-subnetwork"),
 * 			IpCidrRange: pulumi.String("192.168.0.0/24"),
 * 			Region:      pulumi.String("us-central1"),
 * 			Network:     myNetwork.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkconnectivity.NewRegionalEndpoint(ctx, "default", &networkconnectivity.RegionalEndpointArgs{
 * 			Name:            pulumi.String("my-rep"),
 * 			Location:        pulumi.String("us-central1"),
 * 			TargetGoogleApi: pulumi.String("storage.us-central1.p.rep.googleapis.com"),
 * 			AccessType:      pulumi.String("GLOBAL"),
 * 			Address:         pulumi.String("192.168.0.4"),
 * 			Network:         myNetwork.ID(),
 * 			Subnetwork:      mySubnetwork.ID(),
 * 		})
 * 		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.RegionalEndpoint;
 * import com.pulumi.gcp.networkconnectivity.RegionalEndpointArgs;
 * 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 myNetwork = new Network("myNetwork", NetworkArgs.builder()
 *             .name("my-network")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var mySubnetwork = new Subnetwork("mySubnetwork", SubnetworkArgs.builder()
 *             .name("my-subnetwork")
 *             .ipCidrRange("192.168.0.0/24")
 *             .region("us-central1")
 *             .network(myNetwork.id())
 *             .build());
 *         var default_ = new RegionalEndpoint("default", RegionalEndpointArgs.builder()
 *             .name("my-rep")
 *             .location("us-central1")
 *             .targetGoogleApi("storage.us-central1.p.rep.googleapis.com")
 *             .accessType("GLOBAL")
 *             .address("192.168.0.4")
 *             .network(myNetwork.id())
 *             .subnetwork(mySubnetwork.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   myNetwork:
 *     type: gcp:compute:Network
 *     name: my_network
 *     properties:
 *       name: my-network
 *       autoCreateSubnetworks: false
 *   mySubnetwork:
 *     type: gcp:compute:Subnetwork
 *     name: my_subnetwork
 *     properties:
 *       name: my-subnetwork
 *       ipCidrRange: 192.168.0.0/24
 *       region: us-central1
 *       network: ${myNetwork.id}
 *   default:
 *     type: gcp:networkconnectivity:RegionalEndpoint
 *     properties:
 *       name: my-rep
 *       location: us-central1
 *       targetGoogleApi: storage.us-central1.p.rep.googleapis.com
 *       accessType: GLOBAL
 *       address: 192.168.0.4
 *       network: ${myNetwork.id}
 *       subnetwork: ${mySubnetwork.id}
 * ```
 * 
 * ## Import
 * RegionalEndpoint can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/regionalEndpoints/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, RegionalEndpoint can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:networkconnectivity/regionalEndpoint:RegionalEndpoint default projects/{{project}}/locations/{{location}}/regionalEndpoints/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networkconnectivity/regionalEndpoint:RegionalEndpoint default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networkconnectivity/regionalEndpoint:RegionalEndpoint default {{location}}/{{name}}
 * ```
 */
public class RegionalEndpoint internal constructor(
    override val javaResource: com.pulumi.gcp.networkconnectivity.RegionalEndpoint,
) : KotlinCustomResource(javaResource, RegionalEndpointMapper) {
    /**
     * The access type of this regional endpoint. This field is reflected in the PSC Forwarding Rule configuration to enable global access.
     * Possible values are: `GLOBAL`, `REGIONAL`.
     */
    public val accessType: Output
        get() = javaResource.accessType().applyValue({ args0 -> args0 })

    /**
     * The IP Address of the Regional Endpoint. When no address is provided, an IP from the subnetwork is allocated. Use one of the following formats: * IPv4 address as in `10.0.0.1` * Address resource URI as in `projects/{project}/regions/{region}/addresses/{address_name}`
     * > **Note:** This field accepts both a reference to a Compute Address resource, which is the resource name of which format is given in the description, and IP literal value. If the user chooses to input a reserved address value; they need to make sure that the reserved address is in IPv4 version, its purpose is GCE_ENDPOINT, its type is INTERNAL and its status is RESERVED. If the user chooses to input an IP literal, they need to make sure that it's a valid IPv4 address (x.x.x.x) within the subnetwork.
     */
    public val address: Output
        get() = javaResource.address().applyValue({ args0 -> args0 })

    /**
     * Time when the RegionalEndpoint was created.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * A description of this resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * 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.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The location of the RegionalEndpoint.
     * - - -
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name of the RegionalEndpoint.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the VPC network for this private regional endpoint. Format: `projects/{project}/global/networks/{network}`
     */
    public val network: Output
        get() = javaResource.network().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The resource reference of the PSC Forwarding Rule created on behalf of the customer. Format: `//compute.googleapis.com/projects/{project}/regions/{region}/forwardingRules/{forwarding_rule_name}`
     */
    public val pscForwardingRule: Output
        get() = javaResource.pscForwardingRule().applyValue({ args0 -> args0 })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The name of the subnetwork from which the IP address will be allocated. Format: `projects/{project}/regions/{region}/subnetworks/{subnetwork}`
     */
    public val subnetwork: Output
        get() = javaResource.subnetwork().applyValue({ args0 -> args0 })

    /**
     * The service endpoint this private regional endpoint connects to. Format: `{apiname}.{region}.p.rep.googleapis.com` Example: \"cloudkms.us-central1.p.rep.googleapis.com\".
     */
    public val targetGoogleApi: Output
        get() = javaResource.targetGoogleApi().applyValue({ args0 -> args0 })

    /**
     * Time when the RegionalEndpoint was updated.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object RegionalEndpointMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.networkconnectivity.RegionalEndpoint::class == javaResource::class

    override fun map(javaResource: Resource): RegionalEndpoint = RegionalEndpoint(
        javaResource as
            com.pulumi.gcp.networkconnectivity.RegionalEndpoint,
    )
}

/**
 * @see [RegionalEndpoint].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [RegionalEndpoint].
 */
public suspend fun regionalEndpoint(
    name: String,
    block: suspend RegionalEndpointResourceBuilder.() -> Unit,
): RegionalEndpoint {
    val builder = RegionalEndpointResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [RegionalEndpoint].
 * @param name The _unique_ name of the resulting resource.
 */
public fun regionalEndpoint(name: String): RegionalEndpoint {
    val builder = RegionalEndpointResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy