com.pulumi.vault.kotlin.PasswordPolicy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-vault-kotlin Show documentation
Show all versions of pulumi-vault-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@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 [PasswordPolicy].
*/
@PulumiTagMarker
public class PasswordPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: PasswordPolicyArgs = PasswordPolicyArgs()
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 PasswordPolicyArgsBuilder.() -> Unit) {
val builder = PasswordPolicyArgsBuilder()
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(): PasswordPolicy {
val builtJavaResource = com.pulumi.vault.PasswordPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return PasswordPolicy(builtJavaResource)
}
}
/**
* Provides a resource to manage Password Policies
* **Note** this feature is available only Vault 1.5+
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
* const alphanumeric = new vault.PasswordPolicy("alphanumeric", {
* name: "alphanumeric",
* policy: ` length = 20
* rule "charset" {
* charset = "abcdefghijklmnopqrstuvwxyz0123456789"
* }
* `,
* });
* ```
* ```python
* import pulumi
* import pulumi_vault as vault
* alphanumeric = vault.PasswordPolicy("alphanumeric",
* name="alphanumeric",
* policy=""" length = 20
* rule "charset" {
* charset = "abcdefghijklmnopqrstuvwxyz0123456789"
* }
* """)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Vault = Pulumi.Vault;
* return await Deployment.RunAsync(() =>
* {
* var alphanumeric = new Vault.PasswordPolicy("alphanumeric", new()
* {
* Name = "alphanumeric",
* Policy = @" length = 20
* rule ""charset"" {
* charset = ""abcdefghijklmnopqrstuvwxyz0123456789""
* }
* ",
* });
* });
* ```
* ```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 {
* _, err := vault.NewPasswordPolicy(ctx, "alphanumeric", &vault.PasswordPolicyArgs{
* Name: pulumi.String("alphanumeric"),
* Policy: pulumi.String(" length = 20\n rule \"charset\" {\n charset = \"abcdefghijklmnopqrstuvwxyz0123456789\"\n }\n"),
* })
* 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.PasswordPolicy;
* import com.pulumi.vault.PasswordPolicyArgs;
* 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 alphanumeric = new PasswordPolicy("alphanumeric", PasswordPolicyArgs.builder()
* .name("alphanumeric")
* .policy("""
* length = 20
* rule "charset" {
* charset = "abcdefghijklmnopqrstuvwxyz0123456789"
* }
* """)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* alphanumeric:
* type: vault:PasswordPolicy
* properties:
* name: alphanumeric
* policy: |2
* length = 20
* rule "charset" {
* charset = "abcdefghijklmnopqrstuvwxyz0123456789"
* }
* ```
*
* ## Import
* Password policies can be imported using the `name`, e.g.
* ```sh
* $ pulumi import vault:index/passwordPolicy:PasswordPolicy alphanumeric alphanumeric
* ```
*/
public class PasswordPolicy internal constructor(
override val javaResource: com.pulumi.vault.PasswordPolicy,
) : KotlinCustomResource(javaResource, PasswordPolicyMapper) {
/**
* The name of the password policy.
*/
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 containing a password policy.
*/
public val policy: Output
get() = javaResource.policy().applyValue({ args0 -> args0 })
}
public object PasswordPolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.vault.PasswordPolicy::class == javaResource::class
override fun map(javaResource: Resource): PasswordPolicy = PasswordPolicy(
javaResource as
com.pulumi.vault.PasswordPolicy,
)
}
/**
* @see [PasswordPolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [PasswordPolicy].
*/
public suspend fun passwordPolicy(
name: String,
block: suspend PasswordPolicyResourceBuilder.() -> Unit,
): PasswordPolicy {
val builder = PasswordPolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [PasswordPolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun passwordPolicy(name: String): PasswordPolicy {
val builder = PasswordPolicyResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy