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

com.pulumi.gcp.compute.kotlin.RegionNetworkEndpoint.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.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.compute.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: RegionNetworkEndpointArgs = RegionNetworkEndpointArgs()

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

/**
 * A Region network endpoint represents a IP address/FQDN and port combination that is
 * part of a specific network endpoint group (NEG).
 * > **NOTE**: Network endpoints cannot be created outside of a network endpoint group.
 * To get more information about RegionNetworkEndpoint, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/regionNetworkEndpointGroups)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/load-balancing/docs/negs/)
 *     * [Internet NEGs Official Documentation](https://cloud.google.com/load-balancing/docs/negs/internet-neg-concepts)
 * ## Example Usage
 * ### Region Network Endpoint Internet Ip Port
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.compute.Network("default", {
 *     name: "network",
 *     autoCreateSubnetworks: false,
 * });
 * const group = new gcp.compute.RegionNetworkEndpointGroup("group", {
 *     name: "ip-port-neg",
 *     network: _default.id,
 *     region: "us-central1",
 *     networkEndpointType: "INTERNET_IP_PORT",
 * });
 * const region_internet_ip_port_endpoint = new gcp.compute.RegionNetworkEndpoint("region-internet-ip-port-endpoint", {
 *     regionNetworkEndpointGroup: group.name,
 *     region: "us-central1",
 *     ipAddress: "8.8.8.8",
 *     port: 443,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.compute.Network("default",
 *     name="network",
 *     auto_create_subnetworks=False)
 * group = gcp.compute.RegionNetworkEndpointGroup("group",
 *     name="ip-port-neg",
 *     network=default.id,
 *     region="us-central1",
 *     network_endpoint_type="INTERNET_IP_PORT")
 * region_internet_ip_port_endpoint = gcp.compute.RegionNetworkEndpoint("region-internet-ip-port-endpoint",
 *     region_network_endpoint_group=group.name,
 *     region="us-central1",
 *     ip_address="8.8.8.8",
 *     port=443)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Compute.Network("default", new()
 *     {
 *         Name = "network",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var @group = new Gcp.Compute.RegionNetworkEndpointGroup("group", new()
 *     {
 *         Name = "ip-port-neg",
 *         Network = @default.Id,
 *         Region = "us-central1",
 *         NetworkEndpointType = "INTERNET_IP_PORT",
 *     });
 *     var region_internet_ip_port_endpoint = new Gcp.Compute.RegionNetworkEndpoint("region-internet-ip-port-endpoint", new()
 *     {
 *         RegionNetworkEndpointGroup = @group.Name,
 *         Region = "us-central1",
 *         IpAddress = "8.8.8.8",
 *         Port = 443,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("network"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		group, err := compute.NewRegionNetworkEndpointGroup(ctx, "group", &compute.RegionNetworkEndpointGroupArgs{
 * 			Name:                pulumi.String("ip-port-neg"),
 * 			Network:             _default.ID(),
 * 			Region:              pulumi.String("us-central1"),
 * 			NetworkEndpointType: pulumi.String("INTERNET_IP_PORT"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewRegionNetworkEndpoint(ctx, "region-internet-ip-port-endpoint", &compute.RegionNetworkEndpointArgs{
 * 			RegionNetworkEndpointGroup: group.Name,
 * 			Region:                     pulumi.String("us-central1"),
 * 			IpAddress:                  pulumi.String("8.8.8.8"),
 * 			Port:                       pulumi.Int(443),
 * 		})
 * 		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.RegionNetworkEndpointGroup;
 * import com.pulumi.gcp.compute.RegionNetworkEndpointGroupArgs;
 * import com.pulumi.gcp.compute.RegionNetworkEndpoint;
 * import com.pulumi.gcp.compute.RegionNetworkEndpointArgs;
 * 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 default_ = new Network("default", NetworkArgs.builder()
 *             .name("network")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var group = new RegionNetworkEndpointGroup("group", RegionNetworkEndpointGroupArgs.builder()
 *             .name("ip-port-neg")
 *             .network(default_.id())
 *             .region("us-central1")
 *             .networkEndpointType("INTERNET_IP_PORT")
 *             .build());
 *         var region_internet_ip_port_endpoint = new RegionNetworkEndpoint("region-internet-ip-port-endpoint", RegionNetworkEndpointArgs.builder()
 *             .regionNetworkEndpointGroup(group.name())
 *             .region("us-central1")
 *             .ipAddress("8.8.8.8")
 *             .port(443)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   region-internet-ip-port-endpoint:
 *     type: gcp:compute:RegionNetworkEndpoint
 *     properties:
 *       regionNetworkEndpointGroup: ${group.name}
 *       region: us-central1
 *       ipAddress: 8.8.8.8
 *       port: 443
 *   group:
 *     type: gcp:compute:RegionNetworkEndpointGroup
 *     properties:
 *       name: ip-port-neg
 *       network: ${default.id}
 *       region: us-central1
 *       networkEndpointType: INTERNET_IP_PORT
 *   default:
 *     type: gcp:compute:Network
 *     properties:
 *       name: network
 *       autoCreateSubnetworks: false
 * ```
 * 
 * ### Region Network Endpoint Internet Fqdn Port
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.compute.Network("default", {
 *     name: "network",
 *     autoCreateSubnetworks: false,
 * });
 * const group = new gcp.compute.RegionNetworkEndpointGroup("group", {
 *     name: "fqdn-port-neg",
 *     network: _default.id,
 *     region: "us-central1",
 *     networkEndpointType: "INTERNET_FQDN_PORT",
 * });
 * const region_internet_fqdn_port_endpoint = new gcp.compute.RegionNetworkEndpoint("region-internet-fqdn-port-endpoint", {
 *     regionNetworkEndpointGroup: group.name,
 *     region: "us-central1",
 *     fqdn: "backend.example.com",
 *     port: 443,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.compute.Network("default",
 *     name="network",
 *     auto_create_subnetworks=False)
 * group = gcp.compute.RegionNetworkEndpointGroup("group",
 *     name="fqdn-port-neg",
 *     network=default.id,
 *     region="us-central1",
 *     network_endpoint_type="INTERNET_FQDN_PORT")
 * region_internet_fqdn_port_endpoint = gcp.compute.RegionNetworkEndpoint("region-internet-fqdn-port-endpoint",
 *     region_network_endpoint_group=group.name,
 *     region="us-central1",
 *     fqdn="backend.example.com",
 *     port=443)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Compute.Network("default", new()
 *     {
 *         Name = "network",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var @group = new Gcp.Compute.RegionNetworkEndpointGroup("group", new()
 *     {
 *         Name = "fqdn-port-neg",
 *         Network = @default.Id,
 *         Region = "us-central1",
 *         NetworkEndpointType = "INTERNET_FQDN_PORT",
 *     });
 *     var region_internet_fqdn_port_endpoint = new Gcp.Compute.RegionNetworkEndpoint("region-internet-fqdn-port-endpoint", new()
 *     {
 *         RegionNetworkEndpointGroup = @group.Name,
 *         Region = "us-central1",
 *         Fqdn = "backend.example.com",
 *         Port = 443,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("network"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		group, err := compute.NewRegionNetworkEndpointGroup(ctx, "group", &compute.RegionNetworkEndpointGroupArgs{
 * 			Name:                pulumi.String("fqdn-port-neg"),
 * 			Network:             _default.ID(),
 * 			Region:              pulumi.String("us-central1"),
 * 			NetworkEndpointType: pulumi.String("INTERNET_FQDN_PORT"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewRegionNetworkEndpoint(ctx, "region-internet-fqdn-port-endpoint", &compute.RegionNetworkEndpointArgs{
 * 			RegionNetworkEndpointGroup: group.Name,
 * 			Region:                     pulumi.String("us-central1"),
 * 			Fqdn:                       pulumi.String("backend.example.com"),
 * 			Port:                       pulumi.Int(443),
 * 		})
 * 		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.RegionNetworkEndpointGroup;
 * import com.pulumi.gcp.compute.RegionNetworkEndpointGroupArgs;
 * import com.pulumi.gcp.compute.RegionNetworkEndpoint;
 * import com.pulumi.gcp.compute.RegionNetworkEndpointArgs;
 * 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 default_ = new Network("default", NetworkArgs.builder()
 *             .name("network")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var group = new RegionNetworkEndpointGroup("group", RegionNetworkEndpointGroupArgs.builder()
 *             .name("fqdn-port-neg")
 *             .network(default_.id())
 *             .region("us-central1")
 *             .networkEndpointType("INTERNET_FQDN_PORT")
 *             .build());
 *         var region_internet_fqdn_port_endpoint = new RegionNetworkEndpoint("region-internet-fqdn-port-endpoint", RegionNetworkEndpointArgs.builder()
 *             .regionNetworkEndpointGroup(group.name())
 *             .region("us-central1")
 *             .fqdn("backend.example.com")
 *             .port(443)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   region-internet-fqdn-port-endpoint:
 *     type: gcp:compute:RegionNetworkEndpoint
 *     properties:
 *       regionNetworkEndpointGroup: ${group.name}
 *       region: us-central1
 *       fqdn: backend.example.com
 *       port: 443
 *   group:
 *     type: gcp:compute:RegionNetworkEndpointGroup
 *     properties:
 *       name: fqdn-port-neg
 *       network: ${default.id}
 *       region: us-central1
 *       networkEndpointType: INTERNET_FQDN_PORT
 *   default:
 *     type: gcp:compute:Network
 *     properties:
 *       name: network
 *       autoCreateSubnetworks: false
 * ```
 * 
 * ## Import
 * RegionNetworkEndpoint can be imported using any of these accepted formats:
 * * `projects/{{project}}/regions/{{region}}/networkEndpointGroups/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
 * * `{{project}}/{{region}}/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
 * * `{{region}}/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
 * * `{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
 * When using the `pulumi import` command, RegionNetworkEndpoint can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkEndpoint:RegionNetworkEndpoint default projects/{{project}}/regions/{{region}}/networkEndpointGroups/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkEndpoint:RegionNetworkEndpoint default {{project}}/{{region}}/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkEndpoint:RegionNetworkEndpoint default {{region}}/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkEndpoint:RegionNetworkEndpoint default {{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
 * ```
 */
public class RegionNetworkEndpoint internal constructor(
    override val javaResource: com.pulumi.gcp.compute.RegionNetworkEndpoint,
) : KotlinCustomResource(javaResource, RegionNetworkEndpointMapper) {
    /**
     * Fully qualified domain name of network endpoint.
     * This can only be specified when network_endpoint_type of the NEG is INTERNET_FQDN_PORT.
     */
    public val fqdn: Output?
        get() = javaResource.fqdn().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * IPv4 address external endpoint.
     * This can only be specified when network_endpoint_type of the NEG is INTERNET_IP_PORT.
     */
    public val ipAddress: Output?
        get() = javaResource.ipAddress().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Port number of network endpoint.
     */
    public val port: Output
        get() = javaResource.port().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 })

    /**
     * Region where the containing network endpoint group is located.
     */
    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })

    /**
     * The network endpoint group this endpoint is part of.
     * - - -
     */
    public val regionNetworkEndpointGroup: Output
        get() = javaResource.regionNetworkEndpointGroup().applyValue({ args0 -> args0 })
}

public object RegionNetworkEndpointMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.compute.RegionNetworkEndpoint::class == javaResource::class

    override fun map(javaResource: Resource): RegionNetworkEndpoint =
        RegionNetworkEndpoint(javaResource as com.pulumi.gcp.compute.RegionNetworkEndpoint)
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy