com.pulumi.vault.kotlin.EgpPolicy.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
import kotlin.collections.List
/**
* Builder for [EgpPolicy].
*/
@PulumiTagMarker
public class EgpPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: EgpPolicyArgs = EgpPolicyArgs()
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 EgpPolicyArgsBuilder.() -> Unit) {
val builder = EgpPolicyArgsBuilder()
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(): EgpPolicy {
val builtJavaResource = com.pulumi.vault.EgpPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return EgpPolicy(builtJavaResource)
}
}
/**
* Provides a resource to manage Endpoint Governing Policy (EGP) 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.EgpPolicy("allow-all", {
* name: "allow-all",
* paths: ["*"],
* enforcementLevel: "soft-mandatory",
* policy: `main = rule {
* true
* }
* `,
* });
* ```
* ```python
* import pulumi
* import pulumi_vault as vault
* allow_all = vault.EgpPolicy("allow-all",
* name="allow-all",
* paths=["*"],
* 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.EgpPolicy("allow-all", new()
* {
* Name = "allow-all",
* Paths = new[]
* {
* "*",
* },
* 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.NewEgpPolicy(ctx, "allow-all", &vault.EgpPolicyArgs{
* Name: pulumi.String("allow-all"),
* Paths: pulumi.StringArray{
* pulumi.String("*"),
* },
* 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.EgpPolicy;
* import com.pulumi.vault.EgpPolicyArgs;
* 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 EgpPolicy("allow-all", EgpPolicyArgs.builder()
* .name("allow-all")
* .paths("*")
* .enforcementLevel("soft-mandatory")
* .policy("""
* main = rule {
* true
* }
* """)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* allow-all:
* type: vault:EgpPolicy
* properties:
* name: allow-all
* paths:
* - '*'
* enforcementLevel: soft-mandatory
* policy: |
* main = rule {
* true
* }
* ```
*
*/
public class EgpPolicy internal constructor(
override val javaResource: com.pulumi.vault.EgpPolicy,
) : KotlinCustomResource(javaResource, EgpPolicyMapper) {
/**
* 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) })
/**
* List of paths to which the policy will be applied to
*/
public val paths: Output>
get() = javaResource.paths().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* String containing a Sentinel policy
*/
public val policy: Output
get() = javaResource.policy().applyValue({ args0 -> args0 })
}
public object EgpPolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.vault.EgpPolicy::class == javaResource::class
override fun map(javaResource: Resource): EgpPolicy = EgpPolicy(
javaResource as
com.pulumi.vault.EgpPolicy,
)
}
/**
* @see [EgpPolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [EgpPolicy].
*/
public suspend fun egpPolicy(name: String, block: suspend EgpPolicyResourceBuilder.() -> Unit): EgpPolicy {
val builder = EgpPolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [EgpPolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun egpPolicy(name: String): EgpPolicy {
val builder = EgpPolicyResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy