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

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

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

    public var args: AuthBackendArgs = AuthBackendArgs()

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

/**
 * Manages a SAML Auth mount in a Vault server. See the [Vault
 * documentation](https://www.vaultproject.io/docs/auth/saml/) for more
 * information.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const test = new vault.saml.AuthBackend("test", {
 *     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: "admin",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * test = vault.saml.AuthBackend("test",
 *     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="admin")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var test = new Vault.Saml.AuthBackend("test", 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 = "admin",
 *     });
 * });
 * ```
 * ```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 {
 * 		_, err := saml.NewAuthBackend(ctx, "test", &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("admin"),
 * 		})
 * 		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 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 test = new AuthBackend("test", 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("admin")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   test:
 *     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: admin
 * ```
 * 
 * ## Import
 * SAML authentication mounts can be imported using the `path`, e.g.
 * ```sh
 * $ pulumi import vault:saml/authBackend:AuthBackend example saml
 * ```
 */
public class AuthBackend internal constructor(
    override val javaResource: com.pulumi.vault.saml.AuthBackend,
) : KotlinCustomResource(javaResource, AuthBackendMapper) {
    /**
     * The well-formatted URLs of your Assertion Consumer Service (ACS)
     * that should receive a response from the identity provider.
     */
    public val acsUrls: Output>
        get() = javaResource.acsUrls().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The role to use if no role is provided during login.
     */
    public val defaultRole: Output?
        get() = javaResource.defaultRole().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * If set to `true`, opts out of mount migration on path updates.
     * See here for more info on [Mount Migration](https://www.vaultproject.io/docs/concepts/mount-migration)
     */
    public val disableRemount: Output?
        get() = javaResource.disableRemount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The entity ID of the SAML authentication service provider.
     */
    public val entityId: Output
        get() = javaResource.entityId().applyValue({ args0 -> args0 })

    /**
     * The PEM encoded certificate of the identity provider. Mutually exclusive
     * with `idp_metadata_url`.
     */
    public val idpCert: Output?
        get() = javaResource.idpCert().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The entity ID of the identity provider. Mutually exclusive with
     * `idp_metadata_url`.
     */
    public val idpEntityId: Output?
        get() = javaResource.idpEntityId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The metadata URL of the identity provider.
     */
    public val idpMetadataUrl: Output?
        get() = javaResource.idpMetadataUrl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The SSO URL of the identity provider. Mutually exclusive with
     * `idp_metadata_url`.
     */
    public val idpSsoUrl: Output?
        get() = javaResource.idpSsoUrl().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) })

    /**
     * Path where the auth backend will be mounted. Defaults to `auth/saml`
     * if not specified.
     */
    public val path: Output?
        get() = javaResource.path().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * If set to `true`, logs additional, potentially sensitive
     * information during the SAML exchange according to the current logging level. Not
     * recommended for production.
     */
    public val verboseLogging: Output
        get() = javaResource.verboseLogging().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy