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

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

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

    public var args: SecretBackendStaticRoleArgs = SecretBackendStaticRoleArgs()

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

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const aws = new vault.aws.SecretBackend("aws", {
 *     path: "my-aws",
 *     description: "Obtain AWS credentials.",
 * });
 * const role = new vault.aws.SecretBackendStaticRole("role", {
 *     backend: aws.path,
 *     name: "test",
 *     username: "my-test-user",
 *     rotationPeriod: 3600,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * aws = vault.aws.SecretBackend("aws",
 *     path="my-aws",
 *     description="Obtain AWS credentials.")
 * role = vault.aws.SecretBackendStaticRole("role",
 *     backend=aws.path,
 *     name="test",
 *     username="my-test-user",
 *     rotation_period=3600)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var aws = new Vault.Aws.SecretBackend("aws", new()
 *     {
 *         Path = "my-aws",
 *         Description = "Obtain AWS credentials.",
 *     });
 *     var role = new Vault.Aws.SecretBackendStaticRole("role", new()
 *     {
 *         Backend = aws.Path,
 *         Name = "test",
 *         Username = "my-test-user",
 *         RotationPeriod = 3600,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/aws"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		aws, err := aws.NewSecretBackend(ctx, "aws", &aws.SecretBackendArgs{
 * 			Path:        pulumi.String("my-aws"),
 * 			Description: pulumi.String("Obtain AWS credentials."),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = aws.NewSecretBackendStaticRole(ctx, "role", &aws.SecretBackendStaticRoleArgs{
 * 			Backend:        aws.Path,
 * 			Name:           pulumi.String("test"),
 * 			Username:       pulumi.String("my-test-user"),
 * 			RotationPeriod: pulumi.Int(3600),
 * 		})
 * 		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.aws.SecretBackend;
 * import com.pulumi.vault.aws.SecretBackendArgs;
 * import com.pulumi.vault.aws.SecretBackendStaticRole;
 * import com.pulumi.vault.aws.SecretBackendStaticRoleArgs;
 * 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 aws = new SecretBackend("aws", SecretBackendArgs.builder()
 *             .path("my-aws")
 *             .description("Obtain AWS credentials.")
 *             .build());
 *         var role = new SecretBackendStaticRole("role", SecretBackendStaticRoleArgs.builder()
 *             .backend(aws.path())
 *             .name("test")
 *             .username("my-test-user")
 *             .rotationPeriod("3600")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   aws:
 *     type: vault:aws:SecretBackend
 *     properties:
 *       path: my-aws
 *       description: Obtain AWS credentials.
 *   role:
 *     type: vault:aws:SecretBackendStaticRole
 *     properties:
 *       backend: ${aws.path}
 *       name: test
 *       username: my-test-user
 *       rotationPeriod: '3600'
 * ```
 * 
 * ## Import
 * AWS secret backend static role can be imported using the full path to the role
 * of the form: `/static-roles/` e.g.
 * ```sh
 * $ pulumi import vault:aws/secretBackendStaticRole:SecretBackendStaticRole role aws/static-roles/example-role
 * ```
 */
public class SecretBackendStaticRole internal constructor(
    override val javaResource: com.pulumi.vault.aws.SecretBackendStaticRole,
) : KotlinCustomResource(javaResource, SecretBackendStaticRoleMapper) {
    /**
     * The unique path this backend should be mounted at. Must
     * not begin or end with a `/`. Defaults to `aws`
     */
    public val backend: Output?
        get() = javaResource.backend().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name to identify this role within the backend.
     * Must be unique within the backend.
     */
    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 Vault should rotate the password of the user entry.
     */
    public val rotationPeriod: Output
        get() = javaResource.rotationPeriod().applyValue({ args0 -> args0 })

    /**
     * The username of the existing AWS IAM to manage password rotation for.
     */
    public val username: Output
        get() = javaResource.username().applyValue({ args0 -> args0 })
}

public object SecretBackendStaticRoleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.aws.SecretBackendStaticRole::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy