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

com.pulumi.awsnative.ec2.kotlin.Subnet.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.ec2.kotlin

import com.pulumi.awsnative.ec2.kotlin.outputs.PrivateDnsNameOptionsOnLaunchProperties
import com.pulumi.awsnative.kotlin.outputs.Tag
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.List
import com.pulumi.awsnative.ec2.kotlin.outputs.PrivateDnsNameOptionsOnLaunchProperties.Companion.toKotlin as privateDnsNameOptionsOnLaunchPropertiesToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

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

    public var args: SubnetArgs = SubnetArgs()

    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 SubnetArgsBuilder.() -> Unit) {
        val builder = SubnetArgsBuilder()
        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(): Subnet {
        val builtJavaResource = com.pulumi.awsnative.ec2.Subnet(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Subnet(builtJavaResource)
    }
}

/**
 * Specifies a subnet for the specified VPC.
 *  For an IPv4 only subnet, specify an IPv4 CIDR block. If the VPC has an IPv6 CIDR block, you can create an IPv6 only subnet or a dual stack subnet instead. For an IPv6 only subnet, specify an IPv6 CIDR block. For a dual stack subnet, specify both an IPv4 CIDR block and an IPv6 CIDR block.
 *  For more information, see [Subnets for your VPC](https://docs.aws.amazon.com/vpc/latest/userguide/configure-subnets.html) in the *Amazon VPC User Guide*.
 */
public class Subnet internal constructor(
    override val javaResource: com.pulumi.awsnative.ec2.Subnet,
) : KotlinCustomResource(javaResource, SubnetMapper) {
    /**
     * Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is ``false``.
     *  If you specify ``AssignIpv6AddressOnCreation``, you must also specify an IPv6 CIDR block.
     */
    public val assignIpv6AddressOnCreation: Output?
        get() = javaResource.assignIpv6AddressOnCreation().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Availability Zone of the subnet.
     *  If you update this property, you must also update the ``CidrBlock`` property.
     */
    public val availabilityZone: Output?
        get() = javaResource.availabilityZone().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The AZ ID of the subnet.
     */
    public val availabilityZoneId: Output?
        get() = javaResource.availabilityZoneId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The IPv4 CIDR block assigned to the subnet.
     *  If you update this property, we create a new subnet, and then delete the existing one.
     */
    public val cidrBlock: Output?
        get() = javaResource.cidrBlock().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
     *   You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a ``0.0.0.0/0`` route pointing to the internet gateway. For more information, see [Configure DNS64 and NAT64](https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-nat64-dns64.html#nat-gateway-nat64-dns64-walkthrough) in the *User Guide*.
     */
    public val enableDns64: Output?
        get() = javaResource.enableDns64().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Indicates the device position for local network interfaces in this subnet. For example, ``1`` indicates local network interfaces in this subnet are the secondary network interface (eth1).
     */
    public val enableLniAtDeviceIndex: Output?
        get() = javaResource.enableLniAtDeviceIndex().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An IPv4 IPAM pool ID for the subnet.
     */
    public val ipv4IpamPoolId: Output?
        get() = javaResource.ipv4IpamPoolId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An IPv4 netmask length for the subnet.
     */
    public val ipv4NetmaskLength: Output?
        get() = javaResource.ipv4NetmaskLength().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The IPv6 CIDR block.
     *  If you specify ``AssignIpv6AddressOnCreation``, you must also specify an IPv6 CIDR block.
     */
    public val ipv6CidrBlock: Output?
        get() = javaResource.ipv6CidrBlock().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The IPv6 network ranges for the subnet, in CIDR notation.
     */
    public val ipv6CidrBlocks: Output>
        get() = javaResource.ipv6CidrBlocks().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * An IPv6 IPAM pool ID for the subnet.
     */
    public val ipv6IpamPoolId: Output?
        get() = javaResource.ipv6IpamPoolId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Indicates whether this is an IPv6 only subnet. For more information, see [Subnet basics](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html#subnet-basics) in the *User Guide*.
     */
    public val ipv6Native: Output?
        get() = javaResource.ipv6Native().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An IPv6 netmask length for the subnet.
     */
    public val ipv6NetmaskLength: Output?
        get() = javaResource.ipv6NetmaskLength().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is ``false``.
     *   AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the *Public IPv4 Address* tab on the [VPC pricing page](https://docs.aws.amazon.com/vpc/pricing/).
     */
    public val mapPublicIpOnLaunch: Output?
        get() = javaResource.mapPublicIpOnLaunch().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the network ACL that is associated with the subnet's VPC, such as `acl-5fb85d36` .
     */
    public val networkAclAssociationId: Output
        get() = javaResource.networkAclAssociationId().applyValue({ args0 -> args0 })

    /**
     * The Amazon Resource Name (ARN) of the Outpost.
     */
    public val outpostArn: Output?
        get() = javaResource.outpostArn().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled. For more information, see [Amazon EC2 instance hostname types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-naming.html) in the *User Guide*.
     *  Available options:
     *   +  EnableResourceNameDnsAAAARecord (true | false)
     *   +  EnableResourceNameDnsARecord (true | false)
     *   +  HostnameType (ip-name | resource-name)
     */
    public val privateDnsNameOptionsOnLaunch: Output?
        get() = javaResource.privateDnsNameOptionsOnLaunch().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    privateDnsNameOptionsOnLaunchPropertiesToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The ID of the subnet.
     */
    public val subnetId: Output
        get() = javaResource.subnetId().applyValue({ args0 -> args0 })

    /**
     * Any tags assigned to the subnet.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The ID of the VPC the subnet is in.
     *  If you update this property, you must also update the ``CidrBlock`` property.
     */
    public val vpcId: Output
        get() = javaResource.vpcId().applyValue({ args0 -> args0 })
}

public object SubnetMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.ec2.Subnet::class == javaResource::class

    override fun map(javaResource: Resource): Subnet = Subnet(
        javaResource as
            com.pulumi.awsnative.ec2.Subnet,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy