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

com.pulumi.vault.kotlin.MfaDuo.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.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

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

    public var args: MfaDuoArgs = MfaDuoArgs()

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

/**
 * Provides a resource to manage [Duo MFA](https://www.vaultproject.io/docs/enterprise/mfa/mfa-duo.html).
 * **Note** this feature is available only with Vault Enterprise.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const userpass = new vault.AuthBackend("userpass", {
 *     type: "userpass",
 *     path: "userpass",
 * });
 * const myDuo = new vault.MfaDuo("my_duo", {
 *     name: "my_duo",
 *     mountAccessor: userpass.accessor,
 *     secretKey: "8C7THtrIigh2rPZQMbguugt8IUftWhMRCOBzbuyz",
 *     integrationKey: "BIACEUEAXI20BNWTEYXT",
 *     apiHostname: "api-2b5c39f5.duosecurity.com",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * userpass = vault.AuthBackend("userpass",
 *     type="userpass",
 *     path="userpass")
 * my_duo = vault.MfaDuo("my_duo",
 *     name="my_duo",
 *     mount_accessor=userpass.accessor,
 *     secret_key="8C7THtrIigh2rPZQMbguugt8IUftWhMRCOBzbuyz",
 *     integration_key="BIACEUEAXI20BNWTEYXT",
 *     api_hostname="api-2b5c39f5.duosecurity.com")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var userpass = new Vault.AuthBackend("userpass", new()
 *     {
 *         Type = "userpass",
 *         Path = "userpass",
 *     });
 *     var myDuo = new Vault.MfaDuo("my_duo", new()
 *     {
 *         Name = "my_duo",
 *         MountAccessor = userpass.Accessor,
 *         SecretKey = "8C7THtrIigh2rPZQMbguugt8IUftWhMRCOBzbuyz",
 *         IntegrationKey = "BIACEUEAXI20BNWTEYXT",
 *         ApiHostname = "api-2b5c39f5.duosecurity.com",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		userpass, err := vault.NewAuthBackend(ctx, "userpass", &vault.AuthBackendArgs{
 * 			Type: pulumi.String("userpass"),
 * 			Path: pulumi.String("userpass"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vault.NewMfaDuo(ctx, "my_duo", &vault.MfaDuoArgs{
 * 			Name:           pulumi.String("my_duo"),
 * 			MountAccessor:  userpass.Accessor,
 * 			SecretKey:      pulumi.String("8C7THtrIigh2rPZQMbguugt8IUftWhMRCOBzbuyz"),
 * 			IntegrationKey: pulumi.String("BIACEUEAXI20BNWTEYXT"),
 * 			ApiHostname:    pulumi.String("api-2b5c39f5.duosecurity.com"),
 * 		})
 * 		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.AuthBackend;
 * import com.pulumi.vault.AuthBackendArgs;
 * import com.pulumi.vault.MfaDuo;
 * import com.pulumi.vault.MfaDuoArgs;
 * 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 userpass = new AuthBackend("userpass", AuthBackendArgs.builder()
 *             .type("userpass")
 *             .path("userpass")
 *             .build());
 *         var myDuo = new MfaDuo("myDuo", MfaDuoArgs.builder()
 *             .name("my_duo")
 *             .mountAccessor(userpass.accessor())
 *             .secretKey("8C7THtrIigh2rPZQMbguugt8IUftWhMRCOBzbuyz")
 *             .integrationKey("BIACEUEAXI20BNWTEYXT")
 *             .apiHostname("api-2b5c39f5.duosecurity.com")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   userpass:
 *     type: vault:AuthBackend
 *     properties:
 *       type: userpass
 *       path: userpass
 *   myDuo:
 *     type: vault:MfaDuo
 *     name: my_duo
 *     properties:
 *       name: my_duo
 *       mountAccessor: ${userpass.accessor}
 *       secretKey: 8C7THtrIigh2rPZQMbguugt8IUftWhMRCOBzbuyz
 *       integrationKey: BIACEUEAXI20BNWTEYXT
 *       apiHostname: api-2b5c39f5.duosecurity.com
 * ```
 * 
 * ## Import
 * Mounts can be imported using the `path`, e.g.
 * ```sh
 * $ pulumi import vault:index/mfaDuo:MfaDuo my_duo my_duo
 * ```
 */
public class MfaDuo internal constructor(
    override val javaResource: com.pulumi.vault.MfaDuo,
) : KotlinCustomResource(javaResource, MfaDuoMapper) {
    /**
     * `(string: )` - API hostname for Duo.
     */
    public val apiHostname: Output
        get() = javaResource.apiHostname().applyValue({ args0 -> args0 })

    /**
     * `(string: )` - Integration key for Duo.
     */
    public val integrationKey: Output
        get() = javaResource.integrationKey().applyValue({ args0 -> args0 })

    /**
     * `(string: )` - The mount to tie this method to for use in automatic mappings. The mapping will use the Name field of Aliases associated with this mount as the username in the mapping.
     */
    public val mountAccessor: Output
        get() = javaResource.mountAccessor().applyValue({ args0 -> args0 })

    /**
     * `(string: )` – Name of the MFA method.
     */
    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) })

    /**
     * `(string)` - Push information for Duo.
     */
    public val pushInfo: Output?
        get() = javaResource.pushInfo().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * `(string: )` - Secret key for Duo.
     */
    public val secretKey: Output
        get() = javaResource.secretKey().applyValue({ args0 -> args0 })

    /**
     * `(string)` - A format string for mapping Identity names to MFA method names. Values to substitute should be placed in `{{}}`. For example, `"{{alias.name}}@example.com"`. If blank, the Alias's Name field will be used as-is. Currently-supported mappings:
     * - alias.name: The name returned by the mount configured via the `mount_accessor` parameter
     * - entity.name: The name configured for the Entity
     * - alias.metadata.``: The value of the Alias's metadata parameter
     * - entity.metadata.``: The value of the Entity's metadata parameter
     */
    public val usernameFormat: Output?
        get() = javaResource.usernameFormat().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object MfaDuoMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.MfaDuo::class == javaResource::class

    override fun map(javaResource: Resource): MfaDuo = MfaDuo(javaResource as com.pulumi.vault.MfaDuo)
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy