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

com.pulumi.gcp.compute.kotlin.GlobalAddress.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
import kotlin.collections.Map

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

    public var args: GlobalAddressArgs = GlobalAddressArgs()

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

/**
 * Represents a Global Address resource. Global addresses are used for
 * HTTP(S) load balancing.
 * To get more information about GlobalAddress, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/v1/globalAddresses)
 * * How-to Guides
 *     * [Reserving a Static External IP Address](https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address)
 * ## Example Usage
 * ### Global Address Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.compute.GlobalAddress("default", {name: "global-appserver-ip"});
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.compute.GlobalAddress("default", name="global-appserver-ip")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Compute.GlobalAddress("default", new()
 *     {
 *         Name = "global-appserver-ip",
 *     });
 * });
 * ```
 * ```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.NewGlobalAddress(ctx, "default", &compute.GlobalAddressArgs{
 * 			Name: pulumi.String("global-appserver-ip"),
 * 		})
 * 		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.GlobalAddress;
 * import com.pulumi.gcp.compute.GlobalAddressArgs;
 * 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 GlobalAddress("default", GlobalAddressArgs.builder()
 *             .name("global-appserver-ip")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:compute:GlobalAddress
 *     properties:
 *       name: global-appserver-ip
 * ```
 * 
 * ### Global Address Private Services Connect
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const network = new gcp.compute.Network("network", {
 *     name: "my-network-name",
 *     autoCreateSubnetworks: false,
 * });
 * const _default = new gcp.compute.GlobalAddress("default", {
 *     name: "global-psconnect-ip",
 *     addressType: "INTERNAL",
 *     purpose: "PRIVATE_SERVICE_CONNECT",
 *     network: network.id,
 *     address: "100.100.100.105",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * network = gcp.compute.Network("network",
 *     name="my-network-name",
 *     auto_create_subnetworks=False)
 * default = gcp.compute.GlobalAddress("default",
 *     name="global-psconnect-ip",
 *     address_type="INTERNAL",
 *     purpose="PRIVATE_SERVICE_CONNECT",
 *     network=network.id,
 *     address="100.100.100.105")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var network = new Gcp.Compute.Network("network", new()
 *     {
 *         Name = "my-network-name",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var @default = new Gcp.Compute.GlobalAddress("default", new()
 *     {
 *         Name = "global-psconnect-ip",
 *         AddressType = "INTERNAL",
 *         Purpose = "PRIVATE_SERVICE_CONNECT",
 *         Network = network.Id,
 *         Address = "100.100.100.105",
 *     });
 * });
 * ```
 * ```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 {
 * 		network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("my-network-name"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewGlobalAddress(ctx, "default", &compute.GlobalAddressArgs{
 * 			Name:        pulumi.String("global-psconnect-ip"),
 * 			AddressType: pulumi.String("INTERNAL"),
 * 			Purpose:     pulumi.String("PRIVATE_SERVICE_CONNECT"),
 * 			Network:     network.ID(),
 * 			Address:     pulumi.String("100.100.100.105"),
 * 		})
 * 		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.GlobalAddress;
 * import com.pulumi.gcp.compute.GlobalAddressArgs;
 * 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 network = new Network("network", NetworkArgs.builder()
 *             .name("my-network-name")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var default_ = new GlobalAddress("default", GlobalAddressArgs.builder()
 *             .name("global-psconnect-ip")
 *             .addressType("INTERNAL")
 *             .purpose("PRIVATE_SERVICE_CONNECT")
 *             .network(network.id())
 *             .address("100.100.100.105")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:compute:GlobalAddress
 *     properties:
 *       name: global-psconnect-ip
 *       addressType: INTERNAL
 *       purpose: PRIVATE_SERVICE_CONNECT
 *       network: ${network.id}
 *       address: 100.100.100.105
 *   network:
 *     type: gcp:compute:Network
 *     properties:
 *       name: my-network-name
 *       autoCreateSubnetworks: false
 * ```
 * 
 * ## Import
 * GlobalAddress can be imported using any of these accepted formats:
 * * `projects/{{project}}/global/addresses/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, GlobalAddress can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/globalAddress:GlobalAddress default projects/{{project}}/global/addresses/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/globalAddress:GlobalAddress default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/globalAddress:GlobalAddress default {{name}}
 * ```
 */
public class GlobalAddress internal constructor(
    override val javaResource: com.pulumi.gcp.compute.GlobalAddress,
) : KotlinCustomResource(javaResource, GlobalAddressMapper) {
    /**
     * The IP address or beginning of the address range represented by this
     * resource. This can be supplied as an input to reserve a specific
     * address or omitted to allow GCP to choose a valid one for you.
     */
    public val address: Output
        get() = javaResource.address().applyValue({ args0 -> args0 })

    /**
     * The type of the address to reserve.
     * * EXTERNAL indicates public/external single IP address.
     * * INTERNAL indicates internal IP ranges belonging to some network.
     * Default value is `EXTERNAL`.
     * Possible values are: `EXTERNAL`, `INTERNAL`.
     */
    public val addressType: Output?
        get() = javaResource.addressType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

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

    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The IP Version that will be used by this address. The default value is `IPV4`.
     * Possible values are: `IPV4`, `IPV6`.
     */
    public val ipVersion: Output?
        get() = javaResource.ipVersion().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The fingerprint used for optimistic locking of this resource. Used internally during updates.
     */
    public val labelFingerprint: Output
        get() = javaResource.labelFingerprint().applyValue({ args0 -> args0 })

    /**
     * Labels to apply to this address.  A list of key->value pairs.
     * **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)
        })

    /**
     * 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 })

    /**
     * The URL of the network in which to reserve the IP range. The IP range
     * must be in RFC1918 space. The network cannot be deleted if there are
     * any reserved IP ranges referring to it.
     * This should only be set when using an Internal address.
     */
    public val network: Output?
        get() = javaResource.network().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The prefix length of the IP range. If not present, it means the
     * address field is a single IP address.
     * This field is not applicable to addresses with addressType=INTERNAL
     * when purpose=PRIVATE_SERVICE_CONNECT
     */
    public val prefixLength: Output
        get() = javaResource.prefixLength().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 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 purpose of the resource. Possible values include:
     * * VPC_PEERING - for peer networks
     * * PRIVATE_SERVICE_CONNECT - for  Private Service Connect networks
     */
    public val purpose: Output?
        get() = javaResource.purpose().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The URI of the created resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy