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

com.pulumi.gcp.compute.kotlin.GlobalNetworkEndpointGroup.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.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 [GlobalNetworkEndpointGroup].
 */
@PulumiTagMarker
public class GlobalNetworkEndpointGroupResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: GlobalNetworkEndpointGroupArgs = GlobalNetworkEndpointGroupArgs()

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

/**
 * A global network endpoint group contains endpoints that reside outside of Google Cloud.
 * Currently a global network endpoint group can only support a single endpoint.
 * Recreating a global network endpoint group that's in use by another resource will give a
 * `resourceInUseByAnotherResource` error. Use `lifecycle.create_before_destroy`
 * to avoid this type of error.
 * To get more information about GlobalNetworkEndpointGroup, 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/internet-neg-concepts)
 * ## Example Usage
 * ### Global Network Endpoint Group
 * 
 * ```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",
 * });
 * ```
 * ```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")
 * ```
 * ```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",
 *     });
 * });
 * ```
 * ```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.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
 * 		}
 * 		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 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());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   neg:
 *     type: gcp:compute:GlobalNetworkEndpointGroup
 *     properties:
 *       name: my-lb-neg
 *       defaultPort: '90'
 *       networkEndpointType: INTERNET_FQDN_PORT
 * ```
 * 
 * ### Global Network Endpoint Group Ip Address
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const neg = new gcp.compute.GlobalNetworkEndpointGroup("neg", {
 *     name: "my-lb-neg",
 *     networkEndpointType: "INTERNET_IP_PORT",
 *     defaultPort: 90,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * neg = gcp.compute.GlobalNetworkEndpointGroup("neg",
 *     name="my-lb-neg",
 *     network_endpoint_type="INTERNET_IP_PORT",
 *     default_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",
 *         NetworkEndpointType = "INTERNET_IP_PORT",
 *         DefaultPort = 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 {
 * 		_, err := compute.NewGlobalNetworkEndpointGroup(ctx, "neg", &compute.GlobalNetworkEndpointGroupArgs{
 * 			Name:                pulumi.String("my-lb-neg"),
 * 			NetworkEndpointType: pulumi.String("INTERNET_IP_PORT"),
 * 			DefaultPort:         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 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")
 *             .networkEndpointType("INTERNET_IP_PORT")
 *             .defaultPort(90)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   neg:
 *     type: gcp:compute:GlobalNetworkEndpointGroup
 *     properties:
 *       name: my-lb-neg
 *       networkEndpointType: INTERNET_IP_PORT
 *       defaultPort: 90
 * ```
 * 
 * ## Import
 * GlobalNetworkEndpointGroup can be imported using any of these accepted formats:
 * * `projects/{{project}}/global/networkEndpointGroups/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, GlobalNetworkEndpointGroup can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/globalNetworkEndpointGroup:GlobalNetworkEndpointGroup default projects/{{project}}/global/networkEndpointGroups/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/globalNetworkEndpointGroup:GlobalNetworkEndpointGroup default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/globalNetworkEndpointGroup:GlobalNetworkEndpointGroup default {{name}}
 * ```
 */
public class GlobalNetworkEndpointGroup internal constructor(
    override val javaResource: com.pulumi.gcp.compute.GlobalNetworkEndpointGroup,
) : KotlinCustomResource(javaResource, GlobalNetworkEndpointGroupMapper) {
    /**
     * The default port used if the port number is not specified in the
     * network endpoint.
     */
    public val defaultPort: Output?
        get() = javaResource.defaultPort().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An optional description of this resource. Provide this property when
     * you create the resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Name of the resource; provided by the client when the resource is
     * created. The name must be 1-63 characters long, and comply with
     * RFC1035. Specifically, the name must be 1-63 characters long and match
     * the regular expression `a-z?` which means the
     * first character must be a lowercase letter, and all following
     * characters must be a dash, lowercase letter, or digit, except the last
     * character, which cannot be a dash.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Type of network endpoints in this network endpoint group.
     * Possible values are: `INTERNET_IP_PORT`, `INTERNET_FQDN_PORT`.
     * - - -
     */
    public val networkEndpointType: Output
        get() = javaResource.networkEndpointType().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 URI of the created resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy