com.pulumi.vault.identity.kotlin.GroupPolicies.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.identity.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 [GroupPolicies].
*/
@PulumiTagMarker
public class GroupPoliciesResourceBuilder internal constructor() {
public var name: String? = null
public var args: GroupPoliciesArgs = GroupPoliciesArgs()
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 GroupPoliciesArgsBuilder.() -> Unit) {
val builder = GroupPoliciesArgsBuilder()
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(): GroupPolicies {
val builtJavaResource = com.pulumi.vault.identity.GroupPolicies(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return GroupPolicies(builtJavaResource)
}
}
/**
* Manages policies for an Identity Group for Vault. The [Identity secrets engine](https://www.vaultproject.io/docs/secrets/identity/index.html) is the identity management solution for Vault.
* ## Example Usage
* ### Exclusive Policies
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
* const internal = new vault.identity.Group("internal", {
* name: "internal",
* type: "internal",
* externalPolicies: true,
* metadata: {
* version: "2",
* },
* });
* const policies = new vault.identity.GroupPolicies("policies", {
* policies: [
* "default",
* "test",
* ],
* exclusive: true,
* groupId: internal.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_vault as vault
* internal = vault.identity.Group("internal",
* name="internal",
* type="internal",
* external_policies=True,
* metadata={
* "version": "2",
* })
* policies = vault.identity.GroupPolicies("policies",
* policies=[
* "default",
* "test",
* ],
* exclusive=True,
* group_id=internal.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Vault = Pulumi.Vault;
* return await Deployment.RunAsync(() =>
* {
* var @internal = new Vault.Identity.Group("internal", new()
* {
* Name = "internal",
* Type = "internal",
* ExternalPolicies = true,
* Metadata =
* {
* { "version", "2" },
* },
* });
* var policies = new Vault.Identity.GroupPolicies("policies", new()
* {
* Policies = new[]
* {
* "default",
* "test",
* },
* Exclusive = true,
* GroupId = @internal.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-vault/sdk/v6/go/vault/identity"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* internal, err := identity.NewGroup(ctx, "internal", &identity.GroupArgs{
* Name: pulumi.String("internal"),
* Type: pulumi.String("internal"),
* ExternalPolicies: pulumi.Bool(true),
* Metadata: pulumi.StringMap{
* "version": pulumi.String("2"),
* },
* })
* if err != nil {
* return err
* }
* _, err = identity.NewGroupPolicies(ctx, "policies", &identity.GroupPoliciesArgs{
* Policies: pulumi.StringArray{
* pulumi.String("default"),
* pulumi.String("test"),
* },
* Exclusive: pulumi.Bool(true),
* GroupId: internal.ID(),
* })
* 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.identity.Group;
* import com.pulumi.vault.identity.GroupArgs;
* import com.pulumi.vault.identity.GroupPolicies;
* import com.pulumi.vault.identity.GroupPoliciesArgs;
* 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 internal = new Group("internal", GroupArgs.builder()
* .name("internal")
* .type("internal")
* .externalPolicies(true)
* .metadata(Map.of("version", "2"))
* .build());
* var policies = new GroupPolicies("policies", GroupPoliciesArgs.builder()
* .policies(
* "default",
* "test")
* .exclusive(true)
* .groupId(internal.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* internal:
* type: vault:identity:Group
* properties:
* name: internal
* type: internal
* externalPolicies: true
* metadata:
* version: '2'
* policies:
* type: vault:identity:GroupPolicies
* properties:
* policies:
* - default
* - test
* exclusive: true
* groupId: ${internal.id}
* ```
*
* ### Non-exclusive Policies
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
* const internal = new vault.identity.Group("internal", {
* name: "internal",
* type: "internal",
* externalPolicies: true,
* metadata: {
* version: "2",
* },
* });
* const _default = new vault.identity.GroupPolicies("default", {
* policies: [
* "default",
* "test",
* ],
* exclusive: false,
* groupId: internal.id,
* });
* const others = new vault.identity.GroupPolicies("others", {
* policies: ["others"],
* exclusive: false,
* groupId: internal.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_vault as vault
* internal = vault.identity.Group("internal",
* name="internal",
* type="internal",
* external_policies=True,
* metadata={
* "version": "2",
* })
* default = vault.identity.GroupPolicies("default",
* policies=[
* "default",
* "test",
* ],
* exclusive=False,
* group_id=internal.id)
* others = vault.identity.GroupPolicies("others",
* policies=["others"],
* exclusive=False,
* group_id=internal.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Vault = Pulumi.Vault;
* return await Deployment.RunAsync(() =>
* {
* var @internal = new Vault.Identity.Group("internal", new()
* {
* Name = "internal",
* Type = "internal",
* ExternalPolicies = true,
* Metadata =
* {
* { "version", "2" },
* },
* });
* var @default = new Vault.Identity.GroupPolicies("default", new()
* {
* Policies = new[]
* {
* "default",
* "test",
* },
* Exclusive = false,
* GroupId = @internal.Id,
* });
* var others = new Vault.Identity.GroupPolicies("others", new()
* {
* Policies = new[]
* {
* "others",
* },
* Exclusive = false,
* GroupId = @internal.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-vault/sdk/v6/go/vault/identity"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* internal, err := identity.NewGroup(ctx, "internal", &identity.GroupArgs{
* Name: pulumi.String("internal"),
* Type: pulumi.String("internal"),
* ExternalPolicies: pulumi.Bool(true),
* Metadata: pulumi.StringMap{
* "version": pulumi.String("2"),
* },
* })
* if err != nil {
* return err
* }
* _, err = identity.NewGroupPolicies(ctx, "default", &identity.GroupPoliciesArgs{
* Policies: pulumi.StringArray{
* pulumi.String("default"),
* pulumi.String("test"),
* },
* Exclusive: pulumi.Bool(false),
* GroupId: internal.ID(),
* })
* if err != nil {
* return err
* }
* _, err = identity.NewGroupPolicies(ctx, "others", &identity.GroupPoliciesArgs{
* Policies: pulumi.StringArray{
* pulumi.String("others"),
* },
* Exclusive: pulumi.Bool(false),
* GroupId: internal.ID(),
* })
* 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.identity.Group;
* import com.pulumi.vault.identity.GroupArgs;
* import com.pulumi.vault.identity.GroupPolicies;
* import com.pulumi.vault.identity.GroupPoliciesArgs;
* 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 internal = new Group("internal", GroupArgs.builder()
* .name("internal")
* .type("internal")
* .externalPolicies(true)
* .metadata(Map.of("version", "2"))
* .build());
* var default_ = new GroupPolicies("default", GroupPoliciesArgs.builder()
* .policies(
* "default",
* "test")
* .exclusive(false)
* .groupId(internal.id())
* .build());
* var others = new GroupPolicies("others", GroupPoliciesArgs.builder()
* .policies("others")
* .exclusive(false)
* .groupId(internal.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* internal:
* type: vault:identity:Group
* properties:
* name: internal
* type: internal
* externalPolicies: true
* metadata:
* version: '2'
* default:
* type: vault:identity:GroupPolicies
* properties:
* policies:
* - default
* - test
* exclusive: false
* groupId: ${internal.id}
* others:
* type: vault:identity:GroupPolicies
* properties:
* policies:
* - others
* exclusive: false
* groupId: ${internal.id}
* ```
*
*/
public class GroupPolicies internal constructor(
override val javaResource: com.pulumi.vault.identity.GroupPolicies,
) : KotlinCustomResource(javaResource, GroupPoliciesMapper) {
/**
* Defaults to `true`.
* If `true`, this resource will take exclusive control of the policies assigned to the group and will set it equal to what is specified in the resource.
* If set to `false`, this resource will simply ensure that the policies specified in the resource are present in the group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.
*/
public val exclusive: Output?
get() = javaResource.exclusive().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Group ID to assign policies to.
*/
public val groupId: Output
get() = javaResource.groupId().applyValue({ args0 -> args0 })
/**
* The name of the group that are assigned the policies.
*/
public val groupName: Output
get() = javaResource.groupName().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 policies to assign to the group
*/
public val policies: Output>
get() = javaResource.policies().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}
public object GroupPoliciesMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.vault.identity.GroupPolicies::class == javaResource::class
override fun map(javaResource: Resource): GroupPolicies = GroupPolicies(
javaResource as
com.pulumi.vault.identity.GroupPolicies,
)
}
/**
* @see [GroupPolicies].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [GroupPolicies].
*/
public suspend fun groupPolicies(
name: String,
block: suspend GroupPoliciesResourceBuilder.() -> Unit,
): GroupPolicies {
val builder = GroupPoliciesResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [GroupPolicies].
* @param name The _unique_ name of the resulting resource.
*/
public fun groupPolicies(name: String): GroupPolicies {
val builder = GroupPoliciesResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy