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

com.pulumi.vault.ldap.kotlin.SecretBackendDynamicRole.kt Maven / Gradle / Ivy

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

package com.pulumi.vault.ldap.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: SecretBackendDynamicRoleArgs = SecretBackendDynamicRoleArgs()

    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 SecretBackendDynamicRoleArgsBuilder.() -> Unit) {
        val builder = SecretBackendDynamicRoleArgsBuilder()
        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(): SecretBackendDynamicRole {
        val builtJavaResource = com.pulumi.vault.ldap.SecretBackendDynamicRole(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return SecretBackendDynamicRole(builtJavaResource)
    }
}

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const config = new vault.ldap.SecretBackend("config", {
 *     path: "my-custom-ldap",
 *     binddn: "CN=Administrator,CN=Users,DC=corp,DC=example,DC=net",
 *     bindpass: "SuperSecretPassw0rd",
 *     url: "ldaps://localhost",
 *     userdn: "CN=Users,DC=corp,DC=example,DC=net",
 * });
 * const role = new vault.ldap.SecretBackendDynamicRole("role", {
 *     mount: config.path,
 *     roleName: "alice",
 *     creationLdif: `dn: cn={{.Username}},ou=users,dc=learn,dc=example
 * objectClass: person
 * objectClass: top
 * cn: learn
 * sn: {{.Password | utf16le | base64}}
 * memberOf: cn=dev,ou=groups,dc=learn,dc=example
 * userPassword: {{.Password}}
 * `,
 *     deletionLdif: `dn: cn={{.Username}},ou=users,dc=learn,dc=example
 * changetype: delete
 *   rollback_ldif = <
 * {
 *     var config = new Vault.Ldap.SecretBackend("config", new()
 *     {
 *         Path = "my-custom-ldap",
 *         Binddn = "CN=Administrator,CN=Users,DC=corp,DC=example,DC=net",
 *         Bindpass = "SuperSecretPassw0rd",
 *         Url = "ldaps://localhost",
 *         Userdn = "CN=Users,DC=corp,DC=example,DC=net",
 *     });
 *     var role = new Vault.Ldap.SecretBackendDynamicRole("role", new()
 *     {
 *         Mount = config.Path,
 *         RoleName = "alice",
 *         CreationLdif = @"dn: cn={{.Username}},ou=users,dc=learn,dc=example
 * objectClass: person
 * objectClass: top
 * cn: learn
 * sn: {{.Password | utf16le | base64}}
 * memberOf: cn=dev,ou=groups,dc=learn,dc=example
 * userPassword: {{.Password}}
 * ",
 *         DeletionLdif = @"dn: cn={{.Username}},ou=users,dc=learn,dc=example
 * changetype: delete
 *   rollback_ldif = <
 * ## Import
 * LDAP secret backend dynamic role can be imported using the full path to the role
 * of the form: `/dynamic-role/` e.g.
 * ```sh
 * $ pulumi import vault:ldap/secretBackendDynamicRole:SecretBackendDynamicRole role ldap/role/dynamic-role
 * ```
 */
public class SecretBackendDynamicRole internal constructor(
    override val javaResource: com.pulumi.vault.ldap.SecretBackendDynamicRole,
) : KotlinCustomResource(javaResource, SecretBackendDynamicRoleMapper) {
    /**
     * A templatized LDIF string used to create a user
     * account. This may contain multiple LDIF entries. The `creation_ldif` can also
     * be used to add the user account to an existing group. All LDIF entries are
     * performed in order. If Vault encounters an error while executing the
     * `creation_ldif` it will stop at the first error and not execute any remaining
     * LDIF entries. If an error occurs and `rollback_ldif` is specified, the LDIF
     * entries in `rollback_ldif` will be executed. See `rollback_ldif` for more
     * details. This field may optionally be provided as a base64 encoded string.
     */
    public val creationLdif: Output
        get() = javaResource.creationLdif().applyValue({ args0 -> args0 })

    /**
     * Specifies the TTL for the leases associated with this role.
     */
    public val defaultTtl: Output?
        get() = javaResource.defaultTtl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A templatized LDIF string used to delete the
     * user account once its TTL has expired. This may contain multiple LDIF
     * entries. All LDIF entries are performed in order. If Vault encounters an
     * error while executing an entry in the `deletion_ldif` it will attempt to
     * continue executing any remaining entries. This field may optionally be
     * provided as a base64 encoded string.
     */
    public val deletionLdif: Output
        get() = javaResource.deletionLdif().applyValue({ args0 -> args0 })

    /**
     * Specifies the maximum TTL for the leases associated with this role.
     */
    public val maxTtl: Output?
        get() = javaResource.maxTtl().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The unique path this backend should be mounted at. Must
     * not begin or end with a `/`. Defaults to `ldap`.
     */
    public val mount: Output?
        get() = javaResource.mount().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The namespace to provision the resource in.
     * The value should not contain leading or trailing forward slashes.
     * The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
     * *Available only for Vault Enterprise*.
     */
    public val namespace: Output?
        get() = javaResource.namespace().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Name of the role.
     */
    public val roleName: Output
        get() = javaResource.roleName().applyValue({ args0 -> args0 })

    /**
     * A templatized LDIF string used to attempt to
     * rollback any changes in the event that execution of the `creation_ldif` results
     * in an error. This may contain multiple LDIF entries. All LDIF entries are
     * performed in order. If Vault encounters an error while executing an entry in
     * the `rollback_ldif` it will attempt to continue executing any remaining
     * entries. This field may optionally be provided as a base64 encoded string.
     */
    public val rollbackLdif: Output?
        get() = javaResource.rollbackLdif().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A template used to generate a dynamic
     * username. This will be used to fill in the `.Username` field within the
     * `creation_ldif` string.
     */
    public val usernameTemplate: Output?
        get() = javaResource.usernameTemplate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object SecretBackendDynamicRoleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.ldap.SecretBackendDynamicRole::class == javaResource::class

    override fun map(javaResource: Resource): SecretBackendDynamicRole =
        SecretBackendDynamicRole(javaResource as com.pulumi.vault.ldap.SecretBackendDynamicRole)
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy