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

com.pulumi.awsnative.organizations.kotlin.Account.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.organizations.kotlin

import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.awsnative.organizations.kotlin.enums.AccountJoinedMethod
import com.pulumi.awsnative.organizations.kotlin.enums.AccountStatus
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
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin
import com.pulumi.awsnative.organizations.kotlin.enums.AccountJoinedMethod.Companion.toKotlin as accountJoinedMethodToKotlin
import com.pulumi.awsnative.organizations.kotlin.enums.AccountStatus.Companion.toKotlin as accountStatusToKotlin

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

    public var args: AccountArgs = AccountArgs()

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

/**
 * You can use AWS::Organizations::Account to manage accounts in organization.
 */
public class Account internal constructor(
    override val javaResource: com.pulumi.awsnative.organizations.Account,
) : KotlinCustomResource(javaResource, AccountMapper) {
    /**
     * If the account was created successfully, the unique identifier (ID) of the new account.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * The friendly name of the member account.
     */
    public val accountName: Output
        get() = javaResource.accountName().applyValue({ args0 -> args0 })

    /**
     * The Amazon Resource Name (ARN) of the account.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * The email address of the owner to assign to the new member account.
     */
    public val email: Output
        get() = javaResource.email().applyValue({ args0 -> args0 })

    /**
     * The method by which the account joined the organization.
     */
    public val joinedMethod: Output
        get() = javaResource.joinedMethod().applyValue({ args0 ->
            args0.let({ args0 ->
                accountJoinedMethodToKotlin(args0)
            })
        })

    /**
     * The date the account became a part of the organization.
     */
    public val joinedTimestamp: Output
        get() = javaResource.joinedTimestamp().applyValue({ args0 -> args0 })

    /**
     * List of parent nodes for the member account. Currently only one parent at a time is supported. Default is root.
     */
    public val parentIds: Output>?
        get() = javaResource.parentIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The name of an IAM role that AWS Organizations automatically preconfigures in the new member account. Default name is OrganizationAccountAccessRole if not specified.
     */
    public val roleName: Output?
        get() = javaResource.roleName().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The status of the account in the organization.
     */
    public val status: Output
        get() = javaResource.status().applyValue({ args0 ->
            args0.let({ args0 ->
                accountStatusToKotlin(args0)
            })
        })

    /**
     * A list of tags that you want to attach to the newly created account. For each tag in the list, you must specify both a tag key and a value.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object AccountMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.organizations.Account::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy