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

com.pulumi.awsnative.ec2.kotlin.EipAssociation.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: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.ec2.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 [EipAssociation].
 */
@PulumiTagMarker
public class EipAssociationResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: EipAssociationArgs = EipAssociationArgs()

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

/**
 * Associates an Elastic IP address with an instance or a network interface. Before you can use an Elastic IP address, you must allocate it to your account. For more information about working with Elastic IP addresses, see [Elastic IP address concepts and rules](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-eips.html#vpc-eip-overview).
 *  You must specify ``AllocationId`` and either ``InstanceId``, ``NetworkInterfaceId``, or ``PrivateIpAddress``.
 */
public class EipAssociation internal constructor(
    override val javaResource: com.pulumi.awsnative.ec2.EipAssociation,
) : KotlinCustomResource(javaResource, EipAssociationMapper) {
    /**
     * The allocation ID. This is required.
     */
    public val allocationId: Output?
        get() = javaResource.allocationId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    public val eip: Output?
        get() = javaResource.eip().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The ID of the instance. The instance must have exactly one attached network interface. You can specify either the instance ID or the network interface ID, but not both.
     */
    public val instanceId: Output?
        get() = javaResource.instanceId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.
     *  You can specify either the instance ID or the network interface ID, but not both.
     */
    public val networkInterfaceId: Output?
        get() = javaResource.networkInterfaceId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.
     */
    public val privateIpAddress: Output?
        get() = javaResource.privateIpAddress().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy