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

com.pulumi.gcp.compute.kotlin.RouterNatAddress.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.20.1.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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: RouterNatAddressArgs = RouterNatAddressArgs()

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

/**
 * A resource used to set the list of IP addresses to be used in a NAT service and manage the draining of destroyed IPs.
 * > **Note:** This resource is to be used alongside a `gcp.compute.RouterNat` resource,
 * the router nat resource must have no defined `nat_ips` or `drain_nat_ips` parameters,
 * instead using the `initial_nat_ips` parameter to set at least one IP for the creation of the resource.
 * To get more information about RouterNatAddress, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/routers)
 * * How-to Guides
 *     * [Google Cloud Router](https://cloud.google.com/router/docs/)
 * ## Example Usage
 * ## Import
 * RouterNatAddress can be imported using any of these accepted formats:
 * * `projects/{{project}}/regions/{{region}}/routers/{{router}}/{{router_nat}}`
 * * `{{project}}/{{region}}/{{router}}/{{router_nat}}`
 * * `{{region}}/{{router}}/{{router_nat}}`
 * * `{{router}}/{{router_nat}}`
 * When using the `pulumi import` command, RouterNatAddress can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/routerNatAddress:RouterNatAddress default projects/{{project}}/regions/{{region}}/routers/{{router}}/{{router_nat}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/routerNatAddress:RouterNatAddress default {{project}}/{{region}}/{{router}}/{{router_nat}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/routerNatAddress:RouterNatAddress default {{region}}/{{router}}/{{router_nat}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/routerNatAddress:RouterNatAddress default {{router}}/{{router_nat}}
 * ```
 */
public class RouterNatAddress internal constructor(
    override val javaResource: com.pulumi.gcp.compute.RouterNatAddress,
) : KotlinCustomResource(javaResource, RouterNatAddressMapper) {
    /**
     * A list of URLs of the IP resources to be drained. These IPs must be
     * valid static external IPs that have been assigned to the NAT.
     */
    public val drainNatIps: Output>?
        get() = javaResource.drainNatIps().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * Self-links of NAT IPs to be used in a Nat service. Only valid if the referenced RouterNat
     * natIpAllocateOption is set to MANUAL_ONLY.
     */
    public val natIps: Output>
        get() = javaResource.natIps().applyValue({ args0 -> args0.map({ 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 NAT service reside.
     */
    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })

    /**
     * The name of the Cloud Router in which the referenced NAT service is configured.
     */
    public val router: Output
        get() = javaResource.router().applyValue({ args0 -> args0 })

    /**
     * The name of the Nat service in which this address will be configured.
     * - - -
     */
    public val routerNat: Output
        get() = javaResource.routerNat().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy