
com.pulumi.vault.appRole.kotlin.AuthBackendRole.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.appRole.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
import kotlin.collections.List
/**
* 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.appRole.AuthBackendRole(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return AuthBackendRole(builtJavaResource)
}
}
/**
* Manages an AppRole auth backend role in a Vault server. See the [Vault
* documentation](https://www.vaultproject.io/docs/auth/approle) for more
* information.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
* const approle = new vault.AuthBackend("approle", {type: "approle"});
* const example = new vault.approle.AuthBackendRole("example", {
* backend: approle.path,
* roleName: "test-role",
* tokenPolicies: [
* "default",
* "dev",
* "prod",
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_vault as vault
* approle = vault.AuthBackend("approle", type="approle")
* example = vault.app_role.AuthBackendRole("example",
* backend=approle.path,
* role_name="test-role",
* token_policies=[
* "default",
* "dev",
* "prod",
* ])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Vault = Pulumi.Vault;
* return await Deployment.RunAsync(() =>
* {
* var approle = new Vault.AuthBackend("approle", new()
* {
* Type = "approle",
* });
* var example = new Vault.AppRole.AuthBackendRole("example", new()
* {
* Backend = approle.Path,
* RoleName = "test-role",
* TokenPolicies = new[]
* {
* "default",
* "dev",
* "prod",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
* "github.com/pulumi/pulumi-vault/sdk/v6/go/vault/appRole"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* approle, err := vault.NewAuthBackend(ctx, "approle", &vault.AuthBackendArgs{
* Type: pulumi.String("approle"),
* })
* if err != nil {
* return err
* }
* _, err = appRole.NewAuthBackendRole(ctx, "example", &appRole.AuthBackendRoleArgs{
* Backend: approle.Path,
* RoleName: pulumi.String("test-role"),
* TokenPolicies: pulumi.StringArray{
* pulumi.String("default"),
* pulumi.String("dev"),
* pulumi.String("prod"),
* },
* })
* 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.appRole.AuthBackendRole;
* import com.pulumi.vault.appRole.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 approle = new AuthBackend("approle", AuthBackendArgs.builder()
* .type("approle")
* .build());
* var example = new AuthBackendRole("example", AuthBackendRoleArgs.builder()
* .backend(approle.path())
* .roleName("test-role")
* .tokenPolicies(
* "default",
* "dev",
* "prod")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* approle:
* type: vault:AuthBackend
* properties:
* type: approle
* example:
* type: vault:appRole:AuthBackendRole
* properties:
* backend: ${approle.path}
* roleName: test-role
* tokenPolicies:
* - default
* - dev
* - prod
* ```
*
* ## Import
* AppRole authentication backend roles can be imported using the `path`, e.g.
* ```sh
* $ pulumi import vault:appRole/authBackendRole:AuthBackendRole example auth/approle/role/test-role
* ```
*/
public class AuthBackendRole internal constructor(
override val javaResource: com.pulumi.vault.appRole.AuthBackendRole,
) : KotlinCustomResource(javaResource, AuthBackendRoleMapper) {
/**
* The unique name of the auth backend to configure.
* Defaults to `approle`.
*/
public val backend: Output?
get() = javaResource.backend().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Whether or not to require `secret_id` to be
* presented when logging in using this AppRole. Defaults to `true`.
*/
public val bindSecretId: Output?
get() = javaResource.bindSecretId().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) })
/**
* The RoleID of this role. If not specified, one will be
* auto-generated.
*/
public val roleId: Output
get() = javaResource.roleId().applyValue({ args0 -> args0 })
/**
* The name of the role.
*/
public val roleName: Output
get() = javaResource.roleName().applyValue({ args0 -> args0 })
/**
* If set,
* specifies blocks of IP addresses which can perform the login operation.
*/
public val secretIdBoundCidrs: Output>?
get() = javaResource.secretIdBoundCidrs().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(null)
})
/**
* The number of times any particular SecretID
* can be used to fetch a token from this AppRole, after which the SecretID will
* expire. A value of zero will allow unlimited uses.
*/
public val secretIdNumUses: Output?
get() = javaResource.secretIdNumUses().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The number of seconds after which any SecretID
* expires.
*/
public val secretIdTtl: Output?
get() = javaResource.secretIdTtl().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* 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.appRole.AuthBackendRole::class == javaResource::class
override fun map(javaResource: Resource): AuthBackendRole = AuthBackendRole(
javaResource as
com.pulumi.vault.appRole.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