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

com.pulumi.vault.identity.kotlin.OidcKey.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: OidcKeyArgs = OidcKeyArgs()

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

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const key = new vault.identity.OidcKey("key", {
 *     name: "key",
 *     algorithm: "RS256",
 * });
 * const role = new vault.identity.OidcRole("role", {
 *     name: "role",
 *     key: key.name,
 * });
 * const roleOidcKeyAllowedClientID = new vault.identity.OidcKeyAllowedClientID("role", {
 *     keyName: key.name,
 *     allowedClientId: role.clientId,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * key = vault.identity.OidcKey("key",
 *     name="key",
 *     algorithm="RS256")
 * role = vault.identity.OidcRole("role",
 *     name="role",
 *     key=key.name)
 * role_oidc_key_allowed_client_id = vault.identity.OidcKeyAllowedClientID("role",
 *     key_name=key.name,
 *     allowed_client_id=role.client_id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var key = new Vault.Identity.OidcKey("key", new()
 *     {
 *         Name = "key",
 *         Algorithm = "RS256",
 *     });
 *     var role = new Vault.Identity.OidcRole("role", new()
 *     {
 *         Name = "role",
 *         Key = key.Name,
 *     });
 *     var roleOidcKeyAllowedClientID = new Vault.Identity.OidcKeyAllowedClientID("role", new()
 *     {
 *         KeyName = key.Name,
 *         AllowedClientId = role.ClientId,
 *     });
 * });
 * ```
 * ```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 {
 * 		key, err := identity.NewOidcKey(ctx, "key", &identity.OidcKeyArgs{
 * 			Name:      pulumi.String("key"),
 * 			Algorithm: pulumi.String("RS256"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		role, err := identity.NewOidcRole(ctx, "role", &identity.OidcRoleArgs{
 * 			Name: pulumi.String("role"),
 * 			Key:  key.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = identity.NewOidcKeyAllowedClientID(ctx, "role", &identity.OidcKeyAllowedClientIDArgs{
 * 			KeyName:         key.Name,
 * 			AllowedClientId: role.ClientId,
 * 		})
 * 		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.OidcKey;
 * import com.pulumi.vault.identity.OidcKeyArgs;
 * import com.pulumi.vault.identity.OidcRole;
 * import com.pulumi.vault.identity.OidcRoleArgs;
 * import com.pulumi.vault.identity.OidcKeyAllowedClientID;
 * import com.pulumi.vault.identity.OidcKeyAllowedClientIDArgs;
 * 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 key = new OidcKey("key", OidcKeyArgs.builder()
 *             .name("key")
 *             .algorithm("RS256")
 *             .build());
 *         var role = new OidcRole("role", OidcRoleArgs.builder()
 *             .name("role")
 *             .key(key.name())
 *             .build());
 *         var roleOidcKeyAllowedClientID = new OidcKeyAllowedClientID("roleOidcKeyAllowedClientID", OidcKeyAllowedClientIDArgs.builder()
 *             .keyName(key.name())
 *             .allowedClientId(role.clientId())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   key:
 *     type: vault:identity:OidcKey
 *     properties:
 *       name: key
 *       algorithm: RS256
 *   role:
 *     type: vault:identity:OidcRole
 *     properties:
 *       name: role
 *       key: ${key.name}
 *   roleOidcKeyAllowedClientID:
 *     type: vault:identity:OidcKeyAllowedClientID
 *     name: role
 *     properties:
 *       keyName: ${key.name}
 *       allowedClientId: ${role.clientId}
 * ```
 * 
 * ## Import
 * The key can be imported with the key name, for example:
 * ```sh
 * $ pulumi import vault:identity/oidcKey:OidcKey key key
 * ```
 */
public class OidcKey internal constructor(
    override val javaResource: com.pulumi.vault.identity.OidcKey,
) : KotlinCustomResource(javaResource, OidcKeyMapper) {
    /**
     * Signing algorithm to use. Signing algorithm to use.
     * Allowed values are: RS256 (default), RS384, RS512, ES256, ES384, ES512, EdDSA.
     */
    public val algorithm: Output?
        get() = javaResource.algorithm().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Array of role client ID allowed to use this key for signing. If
     * empty, no roles are allowed. If `["*"]`, all roles are allowed.
     */
    public val allowedClientIds: Output>
        get() = javaResource.allowedClientIds().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Name of the OIDC Key to create.
     */
    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) })

    /**
     * How often to generate a new signing key in number of seconds
     */
    public val rotationPeriod: Output?
        get() = javaResource.rotationPeriod().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * "Controls how long the public portion of a signing key will be
     * available for verification after being rotated in seconds.
     */
    public val verificationTtl: Output?
        get() = javaResource.verificationTtl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy