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

com.pulumi.vault.identity.kotlin.OidcAssignment.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.identity.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 [OidcAssignment].
 */
@PulumiTagMarker
public class OidcAssignmentResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: OidcAssignmentArgs = OidcAssignmentArgs()

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

/**
 * Manages OIDC Assignments in a Vault server. See the [Vault documentation](https://www.vaultproject.io/api-docs/secret/identity/oidc-provider#create-or-update-an-assignment)
 * for more information.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const internal = new vault.identity.Group("internal", {
 *     name: "internal",
 *     type: "internal",
 *     policies: [
 *         "dev",
 *         "test",
 *     ],
 * });
 * const test = new vault.identity.Entity("test", {
 *     name: "test",
 *     policies: ["test"],
 * });
 * const _default = new vault.identity.OidcAssignment("default", {
 *     name: "assignment",
 *     entityIds: [test.id],
 *     groupIds: [internal.id],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * internal = vault.identity.Group("internal",
 *     name="internal",
 *     type="internal",
 *     policies=[
 *         "dev",
 *         "test",
 *     ])
 * test = vault.identity.Entity("test",
 *     name="test",
 *     policies=["test"])
 * default = vault.identity.OidcAssignment("default",
 *     name="assignment",
 *     entity_ids=[test.id],
 *     group_ids=[internal.id])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @internal = new Vault.Identity.Group("internal", new()
 *     {
 *         Name = "internal",
 *         Type = "internal",
 *         Policies = new[]
 *         {
 *             "dev",
 *             "test",
 *         },
 *     });
 *     var test = new Vault.Identity.Entity("test", new()
 *     {
 *         Name = "test",
 *         Policies = new[]
 *         {
 *             "test",
 *         },
 *     });
 *     var @default = new Vault.Identity.OidcAssignment("default", new()
 *     {
 *         Name = "assignment",
 *         EntityIds = new[]
 *         {
 *             test.Id,
 *         },
 *         GroupIds = new[]
 *         {
 *             @internal.Id,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/identity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		internal, err := identity.NewGroup(ctx, "internal", &identity.GroupArgs{
 * 			Name: pulumi.String("internal"),
 * 			Type: pulumi.String("internal"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("dev"),
 * 				pulumi.String("test"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		test, err := identity.NewEntity(ctx, "test", &identity.EntityArgs{
 * 			Name: pulumi.String("test"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("test"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = identity.NewOidcAssignment(ctx, "default", &identity.OidcAssignmentArgs{
 * 			Name: pulumi.String("assignment"),
 * 			EntityIds: pulumi.StringArray{
 * 				test.ID(),
 * 			},
 * 			GroupIds: pulumi.StringArray{
 * 				internal.ID(),
 * 			},
 * 		})
 * 		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.identity.Group;
 * import com.pulumi.vault.identity.GroupArgs;
 * import com.pulumi.vault.identity.Entity;
 * import com.pulumi.vault.identity.EntityArgs;
 * import com.pulumi.vault.identity.OidcAssignment;
 * import com.pulumi.vault.identity.OidcAssignmentArgs;
 * 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 internal = new Group("internal", GroupArgs.builder()
 *             .name("internal")
 *             .type("internal")
 *             .policies(
 *                 "dev",
 *                 "test")
 *             .build());
 *         var test = new Entity("test", EntityArgs.builder()
 *             .name("test")
 *             .policies("test")
 *             .build());
 *         var default_ = new OidcAssignment("default", OidcAssignmentArgs.builder()
 *             .name("assignment")
 *             .entityIds(test.id())
 *             .groupIds(internal.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   internal:
 *     type: vault:identity:Group
 *     properties:
 *       name: internal
 *       type: internal
 *       policies:
 *         - dev
 *         - test
 *   test:
 *     type: vault:identity:Entity
 *     properties:
 *       name: test
 *       policies:
 *         - test
 *   default:
 *     type: vault:identity:OidcAssignment
 *     properties:
 *       name: assignment
 *       entityIds:
 *         - ${test.id}
 *       groupIds:
 *         - ${internal.id}
 * ```
 * 
 * ## Import
 * OIDC Assignments can be imported using the `name`, e.g.
 * ```sh
 * $ pulumi import vault:identity/oidcAssignment:OidcAssignment default assignment
 * ```
 */
public class OidcAssignment internal constructor(
    override val javaResource: com.pulumi.vault.identity.OidcAssignment,
) : KotlinCustomResource(javaResource, OidcAssignmentMapper) {
    /**
     * A set of Vault entity IDs.
     */
    public val entityIds: Output>?
        get() = javaResource.entityIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * A set of Vault group IDs.
     */
    public val groupIds: Output>?
        get() = javaResource.groupIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The name of the assignment.
     */
    public val name: Output
        get() = javaResource.name().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) })
}

public object OidcAssignmentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.identity.OidcAssignment::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy