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

com.pulumi.gcp.compute.kotlin.PublicDelegatedPrefix.kt Maven / Gradle / Ivy

@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.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: PublicDelegatedPrefixArgs = PublicDelegatedPrefixArgs()

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

/**
 * Represents a PublicDelegatedPrefix for use with bring your own IP addresses (BYOIP).
 * To get more information about PublicDelegatedPrefix, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/publicDelegatedPrefixes)
 * * How-to Guides
 *     * [Using bring your own IP](https://cloud.google.com/vpc/docs/using-bring-your-own-ip)
 * ## Example Usage
 * ### Public Delegated Prefixes Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const advertised = new gcp.compute.PublicAdvertisedPrefix("advertised", {
 *     name: "my-prefix",
 *     description: "description",
 *     dnsVerificationIp: "127.127.0.0",
 *     ipCidrRange: "127.127.0.0/16",
 * });
 * const prefixes = new gcp.compute.PublicDelegatedPrefix("prefixes", {
 *     name: "my-prefix",
 *     region: "us-central1",
 *     description: "my description",
 *     ipCidrRange: "127.127.0.0/24",
 *     parentPrefix: advertised.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * advertised = gcp.compute.PublicAdvertisedPrefix("advertised",
 *     name="my-prefix",
 *     description="description",
 *     dns_verification_ip="127.127.0.0",
 *     ip_cidr_range="127.127.0.0/16")
 * prefixes = gcp.compute.PublicDelegatedPrefix("prefixes",
 *     name="my-prefix",
 *     region="us-central1",
 *     description="my description",
 *     ip_cidr_range="127.127.0.0/24",
 *     parent_prefix=advertised.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var advertised = new Gcp.Compute.PublicAdvertisedPrefix("advertised", new()
 *     {
 *         Name = "my-prefix",
 *         Description = "description",
 *         DnsVerificationIp = "127.127.0.0",
 *         IpCidrRange = "127.127.0.0/16",
 *     });
 *     var prefixes = new Gcp.Compute.PublicDelegatedPrefix("prefixes", new()
 *     {
 *         Name = "my-prefix",
 *         Region = "us-central1",
 *         Description = "my description",
 *         IpCidrRange = "127.127.0.0/24",
 *         ParentPrefix = advertised.Id,
 *     });
 * });
 * ```
 * ```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 {
 * 		advertised, err := compute.NewPublicAdvertisedPrefix(ctx, "advertised", &compute.PublicAdvertisedPrefixArgs{
 * 			Name:              pulumi.String("my-prefix"),
 * 			Description:       pulumi.String("description"),
 * 			DnsVerificationIp: pulumi.String("127.127.0.0"),
 * 			IpCidrRange:       pulumi.String("127.127.0.0/16"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewPublicDelegatedPrefix(ctx, "prefixes", &compute.PublicDelegatedPrefixArgs{
 * 			Name:         pulumi.String("my-prefix"),
 * 			Region:       pulumi.String("us-central1"),
 * 			Description:  pulumi.String("my description"),
 * 			IpCidrRange:  pulumi.String("127.127.0.0/24"),
 * 			ParentPrefix: advertised.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.PublicAdvertisedPrefix;
 * import com.pulumi.gcp.compute.PublicAdvertisedPrefixArgs;
 * import com.pulumi.gcp.compute.PublicDelegatedPrefix;
 * import com.pulumi.gcp.compute.PublicDelegatedPrefixArgs;
 * 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 advertised = new PublicAdvertisedPrefix("advertised", PublicAdvertisedPrefixArgs.builder()
 *             .name("my-prefix")
 *             .description("description")
 *             .dnsVerificationIp("127.127.0.0")
 *             .ipCidrRange("127.127.0.0/16")
 *             .build());
 *         var prefixes = new PublicDelegatedPrefix("prefixes", PublicDelegatedPrefixArgs.builder()
 *             .name("my-prefix")
 *             .region("us-central1")
 *             .description("my description")
 *             .ipCidrRange("127.127.0.0/24")
 *             .parentPrefix(advertised.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   advertised:
 *     type: gcp:compute:PublicAdvertisedPrefix
 *     properties:
 *       name: my-prefix
 *       description: description
 *       dnsVerificationIp: 127.127.0.0
 *       ipCidrRange: 127.127.0.0/16
 *   prefixes:
 *     type: gcp:compute:PublicDelegatedPrefix
 *     properties:
 *       name: my-prefix
 *       region: us-central1
 *       description: my description
 *       ipCidrRange: 127.127.0.0/24
 *       parentPrefix: ${advertised.id}
 * ```
 * 
 * ## Import
 * PublicDelegatedPrefix can be imported using any of these accepted formats:
 * * `projects/{{project}}/regions/{{region}}/publicDelegatedPrefixes/{{name}}`
 * * `{{project}}/{{region}}/{{name}}`
 * * `{{region}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, PublicDelegatedPrefix can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/publicDelegatedPrefix:PublicDelegatedPrefix default projects/{{project}}/regions/{{region}}/publicDelegatedPrefixes/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/publicDelegatedPrefix:PublicDelegatedPrefix default {{project}}/{{region}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/publicDelegatedPrefix:PublicDelegatedPrefix default {{region}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/publicDelegatedPrefix:PublicDelegatedPrefix default {{name}}
 * ```
 */
public class PublicDelegatedPrefix internal constructor(
    override val javaResource: com.pulumi.gcp.compute.PublicDelegatedPrefix,
) : KotlinCustomResource(javaResource, PublicDelegatedPrefixMapper) {
    /**
     * An optional description of this resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The IPv4 address range, in CIDR format, represented by this public advertised prefix.
     * - - -
     */
    public val ipCidrRange: Output
        get() = javaResource.ipCidrRange().applyValue({ args0 -> args0 })

    /**
     * If true, the prefix will be live migrated.
     */
    public val isLiveMigration: Output?
        get() = javaResource.isLiveMigration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Name of the resource. 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 parent prefix. Either PublicAdvertisedPrefix or PublicDelegatedPrefix.
     */
    public val parentPrefix: Output
        get() = javaResource.parentPrefix().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 })

    /**
     * A region where the prefix will reside.
     */
    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy