com.pulumi.vault.kotlin.Token.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
/**
* Builder for [Token].
*/
@PulumiTagMarker
public class TokenResourceBuilder internal constructor() {
public var name: String? = null
public var args: TokenArgs = TokenArgs()
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 TokenArgsBuilder.() -> Unit) {
val builder = TokenArgsBuilder()
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(): Token {
val builtJavaResource = com.pulumi.vault.Token(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Token(builtJavaResource)
}
}
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
* const example = new vault.Token("example", {
* roleName: "app",
* policies: [
* "policy1",
* "policy2",
* ],
* renewable: true,
* ttl: "24h",
* renewMinLease: 43200,
* renewIncrement: 86400,
* metadata: {
* purpose: "service-account",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_vault as vault
* example = vault.Token("example",
* role_name="app",
* policies=[
* "policy1",
* "policy2",
* ],
* renewable=True,
* ttl="24h",
* renew_min_lease=43200,
* renew_increment=86400,
* metadata={
* "purpose": "service-account",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Vault = Pulumi.Vault;
* return await Deployment.RunAsync(() =>
* {
* var example = new Vault.Token("example", new()
* {
* RoleName = "app",
* Policies = new[]
* {
* "policy1",
* "policy2",
* },
* Renewable = true,
* Ttl = "24h",
* RenewMinLease = 43200,
* RenewIncrement = 86400,
* Metadata =
* {
* { "purpose", "service-account" },
* },
* });
* });
* ```
* ```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.NewToken(ctx, "example", &vault.TokenArgs{
* RoleName: pulumi.String("app"),
* Policies: pulumi.StringArray{
* pulumi.String("policy1"),
* pulumi.String("policy2"),
* },
* Renewable: pulumi.Bool(true),
* Ttl: pulumi.String("24h"),
* RenewMinLease: pulumi.Int(43200),
* RenewIncrement: pulumi.Int(86400),
* Metadata: pulumi.StringMap{
* "purpose": pulumi.String("service-account"),
* },
* })
* 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.Token;
* import com.pulumi.vault.TokenArgs;
* 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 example = new Token("example", TokenArgs.builder()
* .roleName("app")
* .policies(
* "policy1",
* "policy2")
* .renewable(true)
* .ttl("24h")
* .renewMinLease(43200)
* .renewIncrement(86400)
* .metadata(Map.of("purpose", "service-account"))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: vault:Token
* properties:
* roleName: app
* policies:
* - policy1
* - policy2
* renewable: true
* ttl: 24h
* renewMinLease: 43200
* renewIncrement: 86400
* metadata:
* purpose: service-account
* ```
*
* ## Import
* Tokens can be imported using its `id` as accessor id, e.g.
* ```sh
* $ pulumi import vault:index/token:Token example
* ```
*/
public class Token internal constructor(
override val javaResource: com.pulumi.vault.Token,
) : KotlinCustomResource(javaResource, TokenMapper) {
/**
* String containing the client token if stored in present file
*/
public val clientToken: Output
get() = javaResource.clientToken().applyValue({ args0 -> args0 })
/**
* String containing the token display name
*/
public val displayName: Output?
get() = javaResource.displayName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
*/
public val explicitMaxTtl: Output?
get() = javaResource.explicitMaxTtl().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* String containing the token lease duration if present in state file
*/
public val leaseDuration: Output
get() = javaResource.leaseDuration().applyValue({ args0 -> args0 })
/**
* String containing the token lease started time if present in state file
*/
public val leaseStarted: Output
get() = javaResource.leaseStarted().applyValue({ args0 -> args0 })
/**
* Metadata to be set on this token
*/
public val metadata: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy