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

com.pulumi.vault.ldap.kotlin.AuthBackendGroup.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: 6.4.0.0
Show newest version
@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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: AuthBackendGroupArgs = AuthBackendGroupArgs()

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

/**
 * Provides a resource to create a group in an [LDAP auth backend within Vault](https://www.vaultproject.io/docs/auth/ldap.html).
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const ldap = new vault.ldap.AuthBackend("ldap", {
 *     path: "ldap",
 *     url: "ldaps://dc-01.example.org",
 *     userdn: "OU=Users,OU=Accounts,DC=example,DC=org",
 *     userattr: "sAMAccountName",
 *     upndomain: "EXAMPLE.ORG",
 *     discoverdn: false,
 *     groupdn: "OU=Groups,DC=example,DC=org",
 *     groupfilter: "(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))",
 * });
 * const group = new vault.ldap.AuthBackendGroup("group", {
 *     groupname: "dba",
 *     policies: ["dba"],
 *     backend: ldap.path,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * ldap = vault.ldap.AuthBackend("ldap",
 *     path="ldap",
 *     url="ldaps://dc-01.example.org",
 *     userdn="OU=Users,OU=Accounts,DC=example,DC=org",
 *     userattr="sAMAccountName",
 *     upndomain="EXAMPLE.ORG",
 *     discoverdn=False,
 *     groupdn="OU=Groups,DC=example,DC=org",
 *     groupfilter="(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))")
 * group = vault.ldap.AuthBackendGroup("group",
 *     groupname="dba",
 *     policies=["dba"],
 *     backend=ldap.path)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var ldap = new Vault.Ldap.AuthBackend("ldap", new()
 *     {
 *         Path = "ldap",
 *         Url = "ldaps://dc-01.example.org",
 *         Userdn = "OU=Users,OU=Accounts,DC=example,DC=org",
 *         Userattr = "sAMAccountName",
 *         Upndomain = "EXAMPLE.ORG",
 *         Discoverdn = false,
 *         Groupdn = "OU=Groups,DC=example,DC=org",
 *         Groupfilter = "(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))",
 *     });
 *     var @group = new Vault.Ldap.AuthBackendGroup("group", new()
 *     {
 *         Groupname = "dba",
 *         Policies = new[]
 *         {
 *             "dba",
 *         },
 *         Backend = ldap.Path,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/ldap"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		ldap, err := ldap.NewAuthBackend(ctx, "ldap", &ldap.AuthBackendArgs{
 * 			Path:        pulumi.String("ldap"),
 * 			Url:         pulumi.String("ldaps://dc-01.example.org"),
 * 			Userdn:      pulumi.String("OU=Users,OU=Accounts,DC=example,DC=org"),
 * 			Userattr:    pulumi.String("sAMAccountName"),
 * 			Upndomain:   pulumi.String("EXAMPLE.ORG"),
 * 			Discoverdn:  pulumi.Bool(false),
 * 			Groupdn:     pulumi.String("OU=Groups,DC=example,DC=org"),
 * 			Groupfilter: pulumi.String("(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = ldap.NewAuthBackendGroup(ctx, "group", &ldap.AuthBackendGroupArgs{
 * 			Groupname: pulumi.String("dba"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("dba"),
 * 			},
 * 			Backend: ldap.Path,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.vault.ldap.AuthBackend;
 * import com.pulumi.vault.ldap.AuthBackendArgs;
 * import com.pulumi.vault.ldap.AuthBackendGroup;
 * import com.pulumi.vault.ldap.AuthBackendGroupArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var ldap = new AuthBackend("ldap", AuthBackendArgs.builder()
 *             .path("ldap")
 *             .url("ldaps://dc-01.example.org")
 *             .userdn("OU=Users,OU=Accounts,DC=example,DC=org")
 *             .userattr("sAMAccountName")
 *             .upndomain("EXAMPLE.ORG")
 *             .discoverdn(false)
 *             .groupdn("OU=Groups,DC=example,DC=org")
 *             .groupfilter("(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))")
 *             .build());
 *         var group = new AuthBackendGroup("group", AuthBackendGroupArgs.builder()
 *             .groupname("dba")
 *             .policies("dba")
 *             .backend(ldap.path())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   ldap:
 *     type: vault:ldap:AuthBackend
 *     properties:
 *       path: ldap
 *       url: ldaps://dc-01.example.org
 *       userdn: OU=Users,OU=Accounts,DC=example,DC=org
 *       userattr: sAMAccountName
 *       upndomain: EXAMPLE.ORG
 *       discoverdn: false
 *       groupdn: OU=Groups,DC=example,DC=org
 *       groupfilter: (&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))
 *   group:
 *     type: vault:ldap:AuthBackendGroup
 *     properties:
 *       groupname: dba
 *       policies:
 *         - dba
 *       backend: ${ldap.path}
 * ```
 * 
 * ## Import
 * LDAP authentication backend groups can be imported using the `path`, e.g.
 * ```sh
 * $ pulumi import vault:ldap/authBackendGroup:AuthBackendGroup foo auth/ldap/groups/foo
 * ```
 */
public class AuthBackendGroup internal constructor(
    override val javaResource: com.pulumi.vault.ldap.AuthBackendGroup,
) : KotlinCustomResource(javaResource, AuthBackendGroupMapper) {
    /**
     * Path to the authentication backend
     * For more details on the usage of each argument consult the [Vault LDAP API documentation](https://www.vaultproject.io/api-docs/auth/ldap).
     */
    public val backend: Output?
        get() = javaResource.backend().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The LDAP groupname
     */
    public val groupname: Output
        get() = javaResource.groupname().applyValue({ args0 -> args0 })

    /**
     * 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) })

    /**
     * Policies which should be granted to members of the group
     */
    public val policies: Output>
        get() = javaResource.policies().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy