
com.pulumi.vault.kotlin.RgpPolicy.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 [RgpPolicy].
*/
@PulumiTagMarker
public class RgpPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: RgpPolicyArgs = RgpPolicyArgs()
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 RgpPolicyArgsBuilder.() -> Unit) {
val builder = RgpPolicyArgsBuilder()
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(): RgpPolicy {
val builtJavaResource = com.pulumi.vault.RgpPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return RgpPolicy(builtJavaResource)
}
}
/**
* Provides a resource to manage Role Governing Policy (RGP) via [Sentinel](https://www.vaultproject.io/docs/enterprise/sentinel/index.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 allow_all = new vault.RgpPolicy("allow-all", {
* name: "allow-all",
* enforcementLevel: "soft-mandatory",
* policy: `main = rule {
* true
* }
* `,
* });
* ```
* ```python
* import pulumi
* import pulumi_vault as vault
* allow_all = vault.RgpPolicy("allow-all",
* name="allow-all",
* enforcement_level="soft-mandatory",
* policy="""main = rule {
* true
* }
* """)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Vault = Pulumi.Vault;
* return await Deployment.RunAsync(() =>
* {
* var allow_all = new Vault.RgpPolicy("allow-all", new()
* {
* Name = "allow-all",
* EnforcementLevel = "soft-mandatory",
* Policy = @"main = rule {
* true
* }
* ",
* });
* });
* ```
* ```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.NewRgpPolicy(ctx, "allow-all", &vault.RgpPolicyArgs{
* Name: pulumi.String("allow-all"),
* EnforcementLevel: pulumi.String("soft-mandatory"),
* Policy: pulumi.String("main = rule {\n true\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.RgpPolicy;
* import com.pulumi.vault.RgpPolicyArgs;
* 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 allow_all = new RgpPolicy("allow-all", RgpPolicyArgs.builder()
* .name("allow-all")
* .enforcementLevel("soft-mandatory")
* .policy("""
* main = rule {
* true
* }
* """)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* allow-all:
* type: vault:RgpPolicy
* properties:
* name: allow-all
* enforcementLevel: soft-mandatory
* policy: |
* main = rule {
* true
* }
* ```
*
*/
public class RgpPolicy internal constructor(
override val javaResource: com.pulumi.vault.RgpPolicy,
) : KotlinCustomResource(javaResource, RgpPolicyMapper) {
/**
* Enforcement level of Sentinel policy. Can be either `advisory` or `soft-mandatory` or `hard-mandatory`
*/
public val enforcementLevel: Output
get() = javaResource.enforcementLevel().applyValue({ args0 -> args0 })
/**
* The name of the 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 Sentinel policy
*/
public val policy: Output
get() = javaResource.policy().applyValue({ args0 -> args0 })
}
public object RgpPolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.vault.RgpPolicy::class == javaResource::class
override fun map(javaResource: Resource): RgpPolicy = RgpPolicy(
javaResource as
com.pulumi.vault.RgpPolicy,
)
}
/**
* @see [RgpPolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [RgpPolicy].
*/
public suspend fun rgpPolicy(name: String, block: suspend RgpPolicyResourceBuilder.() -> Unit): RgpPolicy {
val builder = RgpPolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [RgpPolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun rgpPolicy(name: String): RgpPolicy {
val builder = RgpPolicyResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy