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

com.pulumi.vault.saml.kotlin.AuthBackendRole.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.6.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.vault.saml.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.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: AuthBackendRoleArgs = AuthBackendRoleArgs()

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

/**
 * Manages an SAML auth backend role in a Vault server. See the [Vault
 * documentation](https://www.vaultproject.io/docs/auth/saml.html) for more
 * information.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const example = new vault.saml.AuthBackend("example", {
 *     path: "saml",
 *     idpMetadataUrl: "https://company.okta.com/app/abc123eb9xnIfzlaf697/sso/saml/metadata",
 *     entityId: "https://my.vault/v1/auth/saml",
 *     acsUrls: ["https://my.vault.primary/v1/auth/saml/callback"],
 *     defaultRole: "default-role",
 * });
 * const exampleAuthBackendRole = new vault.saml.AuthBackendRole("example", {
 *     path: example.path,
 *     name: "my-role",
 *     groupsAttribute: "groups",
 *     boundAttributes: {
 *         group: "admin",
 *     },
 *     boundSubjects: ["*example.com"],
 *     tokenPolicies: ["writer"],
 *     tokenTtl: 86400,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * example = vault.saml.AuthBackend("example",
 *     path="saml",
 *     idp_metadata_url="https://company.okta.com/app/abc123eb9xnIfzlaf697/sso/saml/metadata",
 *     entity_id="https://my.vault/v1/auth/saml",
 *     acs_urls=["https://my.vault.primary/v1/auth/saml/callback"],
 *     default_role="default-role")
 * example_auth_backend_role = vault.saml.AuthBackendRole("example",
 *     path=example.path,
 *     name="my-role",
 *     groups_attribute="groups",
 *     bound_attributes={
 *         "group": "admin",
 *     },
 *     bound_subjects=["*example.com"],
 *     token_policies=["writer"],
 *     token_ttl=86400)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Vault.Saml.AuthBackend("example", new()
 *     {
 *         Path = "saml",
 *         IdpMetadataUrl = "https://company.okta.com/app/abc123eb9xnIfzlaf697/sso/saml/metadata",
 *         EntityId = "https://my.vault/v1/auth/saml",
 *         AcsUrls = new[]
 *         {
 *             "https://my.vault.primary/v1/auth/saml/callback",
 *         },
 *         DefaultRole = "default-role",
 *     });
 *     var exampleAuthBackendRole = new Vault.Saml.AuthBackendRole("example", new()
 *     {
 *         Path = example.Path,
 *         Name = "my-role",
 *         GroupsAttribute = "groups",
 *         BoundAttributes =
 *         {
 *             { "group", "admin" },
 *         },
 *         BoundSubjects = new[]
 *         {
 *             "*example.com",
 *         },
 *         TokenPolicies = new[]
 *         {
 *             "writer",
 *         },
 *         TokenTtl = 86400,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/saml"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := saml.NewAuthBackend(ctx, "example", &saml.AuthBackendArgs{
 * 			Path:           pulumi.String("saml"),
 * 			IdpMetadataUrl: pulumi.String("https://company.okta.com/app/abc123eb9xnIfzlaf697/sso/saml/metadata"),
 * 			EntityId:       pulumi.String("https://my.vault/v1/auth/saml"),
 * 			AcsUrls: pulumi.StringArray{
 * 				pulumi.String("https://my.vault.primary/v1/auth/saml/callback"),
 * 			},
 * 			DefaultRole: pulumi.String("default-role"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = saml.NewAuthBackendRole(ctx, "example", &saml.AuthBackendRoleArgs{
 * 			Path:            example.Path,
 * 			Name:            pulumi.String("my-role"),
 * 			GroupsAttribute: pulumi.String("groups"),
 * 			BoundAttributes: pulumi.Map{
 * 				"group": pulumi.Any("admin"),
 * 			},
 * 			BoundSubjects: pulumi.StringArray{
 * 				pulumi.String("*example.com"),
 * 			},
 * 			TokenPolicies: pulumi.StringArray{
 * 				pulumi.String("writer"),
 * 			},
 * 			TokenTtl: pulumi.Int(86400),
 * 		})
 * 		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.saml.AuthBackend;
 * import com.pulumi.vault.saml.AuthBackendArgs;
 * import com.pulumi.vault.saml.AuthBackendRole;
 * import com.pulumi.vault.saml.AuthBackendRoleArgs;
 * 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 example = new AuthBackend("example", AuthBackendArgs.builder()
 *             .path("saml")
 *             .idpMetadataUrl("https://company.okta.com/app/abc123eb9xnIfzlaf697/sso/saml/metadata")
 *             .entityId("https://my.vault/v1/auth/saml")
 *             .acsUrls("https://my.vault.primary/v1/auth/saml/callback")
 *             .defaultRole("default-role")
 *             .build());
 *         var exampleAuthBackendRole = new AuthBackendRole("exampleAuthBackendRole", AuthBackendRoleArgs.builder()
 *             .path(example.path())
 *             .name("my-role")
 *             .groupsAttribute("groups")
 *             .boundAttributes(Map.of("group", "admin"))
 *             .boundSubjects("*example.com")
 *             .tokenPolicies("writer")
 *             .tokenTtl(86400)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: vault:saml:AuthBackend
 *     properties:
 *       path: saml
 *       idpMetadataUrl: https://company.okta.com/app/abc123eb9xnIfzlaf697/sso/saml/metadata
 *       entityId: https://my.vault/v1/auth/saml
 *       acsUrls:
 *         - https://my.vault.primary/v1/auth/saml/callback
 *       defaultRole: default-role
 *   exampleAuthBackendRole:
 *     type: vault:saml:AuthBackendRole
 *     name: example
 *     properties:
 *       path: ${example.path}
 *       name: my-role
 *       groupsAttribute: groups
 *       boundAttributes:
 *         group: admin
 *       boundSubjects:
 *         - '*example.com'
 *       tokenPolicies:
 *         - writer
 *       tokenTtl: 86400
 * ```
 * 
 * ## Import
 * SAML authentication backend roles can be imported using the `path`, e.g.
 * ```sh
 * $ pulumi import vault:saml/authBackendRole:AuthBackendRole example auth/saml/role/my-role
 * ```
 */
public class AuthBackendRole internal constructor(
    override val javaResource: com.pulumi.vault.saml.AuthBackendRole,
) : KotlinCustomResource(javaResource, AuthBackendRoleMapper) {
    /**
     * Mapping of attribute names to values that are expected to
     * exist in the SAML assertion.
     */
    public val boundAttributes: Output>?
        get() = javaResource.boundAttributes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0.key.to(args0.value) }).toMap()
            }).orElse(null)
        })

    /**
     * The type of matching assertion to perform on
     * `bound_attributes_type`.
     */
    public val boundAttributesType: Output
        get() = javaResource.boundAttributesType().applyValue({ args0 -> args0 })

    /**
     * List of subjects being asserted for SAML authentication.
     */
    public val boundSubjects: Output>?
        get() = javaResource.boundSubjects().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The type of matching assertion to perform on `bound_subjects`.
     */
    public val boundSubjectsType: Output
        get() = javaResource.boundSubjectsType().applyValue({ args0 -> args0 })

    /**
     * The attribute to use to identify the set of groups to which the
     * user belongs.
     */
    public val groupsAttribute: Output?
        get() = javaResource.groupsAttribute().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Unique name of the role.
     */
    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) })

    /**
     * Path where the auth backend is mounted.
     */
    public val path: Output
        get() = javaResource.path().applyValue({ args0 -> args0 })

    /**
     * Specifies the blocks of IP addresses which are allowed to use the generated token
     */
    public val tokenBoundCidrs: Output>?
        get() = javaResource.tokenBoundCidrs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * Generated Token's Explicit Maximum TTL in seconds
     */
    public val tokenExplicitMaxTtl: Output?
        get() = javaResource.tokenExplicitMaxTtl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The maximum lifetime of the generated token
     */
    public val tokenMaxTtl: Output?
        get() = javaResource.tokenMaxTtl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * If true, the 'default' policy will not automatically be added to generated tokens
     */
    public val tokenNoDefaultPolicy: Output?
        get() = javaResource.tokenNoDefaultPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The maximum number of times a token may be used, a value of zero means unlimited
     */
    public val tokenNumUses: Output?
        get() = javaResource.tokenNumUses().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Generated Token's Period
     */
    public val tokenPeriod: Output?
        get() = javaResource.tokenPeriod().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Generated Token's Policies
     */
    public val tokenPolicies: Output>?
        get() = javaResource.tokenPolicies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The initial ttl of the token to generate in seconds
     */
    public val tokenTtl: Output?
        get() = javaResource.tokenTtl().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The type of token to generate, service or batch
     */
    public val tokenType: Output?
        get() = javaResource.tokenType().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object AuthBackendRoleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.saml.AuthBackendRole::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy