com.pulumi.gcp.compute.kotlin.GlobalNetworkEndpoint.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.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 [GlobalNetworkEndpoint].
*/
@PulumiTagMarker
public class GlobalNetworkEndpointResourceBuilder internal constructor() {
public var name: String? = null
public var args: GlobalNetworkEndpointArgs = GlobalNetworkEndpointArgs()
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 GlobalNetworkEndpointArgsBuilder.() -> Unit) {
val builder = GlobalNetworkEndpointArgsBuilder()
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(): GlobalNetworkEndpoint {
val builtJavaResource = com.pulumi.gcp.compute.GlobalNetworkEndpoint(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return GlobalNetworkEndpoint(builtJavaResource)
}
}
/**
* A Global Network endpoint represents a IP address and port combination that exists outside of GCP.
* **NOTE**: Global network endpoints cannot be created outside of a
* global network endpoint group.
* To get more information about GlobalNetworkEndpoint, see:
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/networkEndpointGroups)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/load-balancing/docs/negs/)
* ## Example Usage
* ### Global Network Endpoint
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const neg = new gcp.compute.GlobalNetworkEndpointGroup("neg", {
* name: "my-lb-neg",
* defaultPort: 90,
* networkEndpointType: "INTERNET_FQDN_PORT",
* });
* const default_endpoint = new gcp.compute.GlobalNetworkEndpoint("default-endpoint", {
* globalNetworkEndpointGroup: neg.name,
* fqdn: "www.example.com",
* port: 90,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* neg = gcp.compute.GlobalNetworkEndpointGroup("neg",
* name="my-lb-neg",
* default_port=90,
* network_endpoint_type="INTERNET_FQDN_PORT")
* default_endpoint = gcp.compute.GlobalNetworkEndpoint("default-endpoint",
* global_network_endpoint_group=neg.name,
* fqdn="www.example.com",
* port=90)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var neg = new Gcp.Compute.GlobalNetworkEndpointGroup("neg", new()
* {
* Name = "my-lb-neg",
* DefaultPort = 90,
* NetworkEndpointType = "INTERNET_FQDN_PORT",
* });
* var default_endpoint = new Gcp.Compute.GlobalNetworkEndpoint("default-endpoint", new()
* {
* GlobalNetworkEndpointGroup = neg.Name,
* Fqdn = "www.example.com",
* Port = 90,
* });
* });
* ```
* ```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 {
* neg, err := compute.NewGlobalNetworkEndpointGroup(ctx, "neg", &compute.GlobalNetworkEndpointGroupArgs{
* Name: pulumi.String("my-lb-neg"),
* DefaultPort: pulumi.Int(90),
* NetworkEndpointType: pulumi.String("INTERNET_FQDN_PORT"),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewGlobalNetworkEndpoint(ctx, "default-endpoint", &compute.GlobalNetworkEndpointArgs{
* GlobalNetworkEndpointGroup: neg.Name,
* Fqdn: pulumi.String("www.example.com"),
* Port: pulumi.Int(90),
* })
* 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.GlobalNetworkEndpointGroup;
* import com.pulumi.gcp.compute.GlobalNetworkEndpointGroupArgs;
* import com.pulumi.gcp.compute.GlobalNetworkEndpoint;
* import com.pulumi.gcp.compute.GlobalNetworkEndpointArgs;
* 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 neg = new GlobalNetworkEndpointGroup("neg", GlobalNetworkEndpointGroupArgs.builder()
* .name("my-lb-neg")
* .defaultPort("90")
* .networkEndpointType("INTERNET_FQDN_PORT")
* .build());
* var default_endpoint = new GlobalNetworkEndpoint("default-endpoint", GlobalNetworkEndpointArgs.builder()
* .globalNetworkEndpointGroup(neg.name())
* .fqdn("www.example.com")
* .port(90)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default-endpoint:
* type: gcp:compute:GlobalNetworkEndpoint
* properties:
* globalNetworkEndpointGroup: ${neg.name}
* fqdn: www.example.com
* port: 90
* neg:
* type: gcp:compute:GlobalNetworkEndpointGroup
* properties:
* name: my-lb-neg
* defaultPort: '90'
* networkEndpointType: INTERNET_FQDN_PORT
* ```
*
* ## Import
* GlobalNetworkEndpoint can be imported using any of these accepted formats:
* * `projects/{{project}}/global/networkEndpointGroups/{{global_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
* * `{{project}}/{{global_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
* * `{{global_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
* When using the `pulumi import` command, GlobalNetworkEndpoint can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/globalNetworkEndpoint:GlobalNetworkEndpoint default projects/{{project}}/global/networkEndpointGroups/{{global_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
* ```
* ```sh
* $ pulumi import gcp:compute/globalNetworkEndpoint:GlobalNetworkEndpoint default {{project}}/{{global_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
* ```
* ```sh
* $ pulumi import gcp:compute/globalNetworkEndpoint:GlobalNetworkEndpoint default {{global_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
* ```
*/
public class GlobalNetworkEndpoint internal constructor(
override val javaResource: com.pulumi.gcp.compute.GlobalNetworkEndpoint,
) : KotlinCustomResource(javaResource, GlobalNetworkEndpointMapper) {
/**
* 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) })
/**
* The global network endpoint group this endpoint is part of.
* - - -
*/
public val globalNetworkEndpointGroup: Output
get() = javaResource.globalNetworkEndpointGroup().applyValue({ args0 -> args0 })
/**
* IPv4 address external endpoint.
*/
public val ipAddress: Output?
get() = javaResource.ipAddress().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Port number of the external 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 })
}
public object GlobalNetworkEndpointMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.GlobalNetworkEndpoint::class == javaResource::class
override fun map(javaResource: Resource): GlobalNetworkEndpoint =
GlobalNetworkEndpoint(javaResource as com.pulumi.gcp.compute.GlobalNetworkEndpoint)
}
/**
* @see [GlobalNetworkEndpoint].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [GlobalNetworkEndpoint].
*/
public suspend fun globalNetworkEndpoint(
name: String,
block: suspend GlobalNetworkEndpointResourceBuilder.() -> Unit,
): GlobalNetworkEndpoint {
val builder = GlobalNetworkEndpointResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [GlobalNetworkEndpoint].
* @param name The _unique_ name of the resulting resource.
*/
public fun globalNetworkEndpoint(name: String): GlobalNetworkEndpoint {
val builder = GlobalNetworkEndpointResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy