All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.vault.rabbitMq.kotlin.SecretBackendRole.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.4.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.vault.rabbitMq.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 com.pulumi.vault.rabbitMq.kotlin.outputs.SecretBackendRoleVhost
import com.pulumi.vault.rabbitMq.kotlin.outputs.SecretBackendRoleVhostTopic
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.vault.rabbitMq.kotlin.outputs.SecretBackendRoleVhost.Companion.toKotlin as secretBackendRoleVhostToKotlin
import com.pulumi.vault.rabbitMq.kotlin.outputs.SecretBackendRoleVhostTopic.Companion.toKotlin as secretBackendRoleVhostTopicToKotlin

/**
 * Builder for [SecretBackendRole].
 */
@PulumiTagMarker
public class SecretBackendRoleResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: SecretBackendRoleArgs = SecretBackendRoleArgs()

    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 SecretBackendRoleArgsBuilder.() -> Unit) {
        val builder = SecretBackendRoleArgsBuilder()
        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(): SecretBackendRole {
        val builtJavaResource = com.pulumi.vault.rabbitMq.SecretBackendRole(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return SecretBackendRole(builtJavaResource)
    }
}

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const rabbitmq = new vault.rabbitmq.SecretBackend("rabbitmq", {
 *     connectionUri: "https://.....",
 *     username: "user",
 *     password: "password",
 * });
 * const role = new vault.rabbitmq.SecretBackendRole("role", {
 *     backend: rabbitmq.path,
 *     name: "deploy",
 *     tags: "tag1,tag2",
 *     vhosts: [{
 *         host: "/",
 *         configure: "",
 *         read: ".*",
 *         write: "",
 *     }],
 *     vhostTopics: [{
 *         vhosts: [{
 *             topic: "amq.topic",
 *             read: ".*",
 *             write: "",
 *         }],
 *         host: "/",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * rabbitmq = vault.rabbit_mq.SecretBackend("rabbitmq",
 *     connection_uri="https://.....",
 *     username="user",
 *     password="password")
 * role = vault.rabbit_mq.SecretBackendRole("role",
 *     backend=rabbitmq.path,
 *     name="deploy",
 *     tags="tag1,tag2",
 *     vhosts=[vault.rabbit_mq.SecretBackendRoleVhostArgs(
 *         host="/",
 *         configure="",
 *         read=".*",
 *         write="",
 *     )],
 *     vhost_topics=[vault.rabbit_mq.SecretBackendRoleVhostTopicArgs(
 *         vhosts=[vault.rabbit_mq.SecretBackendRoleVhostTopicVhostArgs(
 *             topic="amq.topic",
 *             read=".*",
 *             write="",
 *         )],
 *         host="/",
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var rabbitmq = new Vault.RabbitMQ.SecretBackend("rabbitmq", new()
 *     {
 *         ConnectionUri = "https://.....",
 *         Username = "user",
 *         Password = "password",
 *     });
 *     var role = new Vault.RabbitMQ.SecretBackendRole("role", new()
 *     {
 *         Backend = rabbitmq.Path,
 *         Name = "deploy",
 *         Tags = "tag1,tag2",
 *         Vhosts = new[]
 *         {
 *             new Vault.RabbitMQ.Inputs.SecretBackendRoleVhostArgs
 *             {
 *                 Host = "/",
 *                 Configure = "",
 *                 Read = ".*",
 *                 Write = "",
 *             },
 *         },
 *         VhostTopics = new[]
 *         {
 *             new Vault.RabbitMQ.Inputs.SecretBackendRoleVhostTopicArgs
 *             {
 *                 Vhosts = new[]
 *                 {
 *                     new Vault.RabbitMQ.Inputs.SecretBackendRoleVhostTopicVhostArgs
 *                     {
 *                         Topic = "amq.topic",
 *                         Read = ".*",
 *                         Write = "",
 *                     },
 *                 },
 *                 Host = "/",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/rabbitMq"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		rabbitmq, err := rabbitMq.NewSecretBackend(ctx, "rabbitmq", &rabbitMq.SecretBackendArgs{
 * 			ConnectionUri: pulumi.String("https://....."),
 * 			Username:      pulumi.String("user"),
 * 			Password:      pulumi.String("password"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = rabbitMq.NewSecretBackendRole(ctx, "role", &rabbitMq.SecretBackendRoleArgs{
 * 			Backend: rabbitmq.Path,
 * 			Name:    pulumi.String("deploy"),
 * 			Tags:    pulumi.String("tag1,tag2"),
 * 			Vhosts: rabbitmq.SecretBackendRoleVhostArray{
 * 				&rabbitmq.SecretBackendRoleVhostArgs{
 * 					Host:      pulumi.String("/"),
 * 					Configure: pulumi.String(""),
 * 					Read:      pulumi.String(".*"),
 * 					Write:     pulumi.String(""),
 * 				},
 * 			},
 * 			VhostTopics: rabbitmq.SecretBackendRoleVhostTopicArray{
 * 				&rabbitmq.SecretBackendRoleVhostTopicArgs{
 * 					Vhosts: rabbitmq.SecretBackendRoleVhostTopicVhostArray{
 * 						&rabbitmq.SecretBackendRoleVhostTopicVhostArgs{
 * 							Topic: pulumi.String("amq.topic"),
 * 							Read:  pulumi.String(".*"),
 * 							Write: pulumi.String(""),
 * 						},
 * 					},
 * 					Host: pulumi.String("/"),
 * 				},
 * 			},
 * 		})
 * 		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.rabbitMq.SecretBackend;
 * import com.pulumi.vault.rabbitMq.SecretBackendArgs;
 * import com.pulumi.vault.rabbitMq.SecretBackendRole;
 * import com.pulumi.vault.rabbitMq.SecretBackendRoleArgs;
 * import com.pulumi.vault.rabbitMq.inputs.SecretBackendRoleVhostArgs;
 * import com.pulumi.vault.rabbitMq.inputs.SecretBackendRoleVhostTopicArgs;
 * 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 rabbitmq = new SecretBackend("rabbitmq", SecretBackendArgs.builder()
 *             .connectionUri("https://.....")
 *             .username("user")
 *             .password("password")
 *             .build());
 *         var role = new SecretBackendRole("role", SecretBackendRoleArgs.builder()
 *             .backend(rabbitmq.path())
 *             .name("deploy")
 *             .tags("tag1,tag2")
 *             .vhosts(SecretBackendRoleVhostArgs.builder()
 *                 .host("/")
 *                 .configure("")
 *                 .read(".*")
 *                 .write("")
 *                 .build())
 *             .vhostTopics(SecretBackendRoleVhostTopicArgs.builder()
 *                 .vhosts(SecretBackendRoleVhostTopicVhostArgs.builder()
 *                     .topic("amq.topic")
 *                     .read(".*")
 *                     .write("")
 *                     .build())
 *                 .host("/")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   rabbitmq:
 *     type: vault:rabbitMq:SecretBackend
 *     properties:
 *       connectionUri: https://.....
 *       username: user
 *       password: password
 *   role:
 *     type: vault:rabbitMq:SecretBackendRole
 *     properties:
 *       backend: ${rabbitmq.path}
 *       name: deploy
 *       tags: tag1,tag2
 *       vhosts:
 *         - host: /
 *           configure:
 *           read: .*
 *           write:
 *       vhostTopics:
 *         - vhosts:
 *             - topic: amq.topic
 *               read: .*
 *               write:
 *           host: /
 * ```
 * 
 * ## Import
 * RabbitMQ secret backend roles can be imported using the `path`, e.g.
 * ```sh
 * $ pulumi import vault:rabbitMq/secretBackendRole:SecretBackendRole role rabbitmq/roles/deploy
 * ```
 */
public class SecretBackendRole internal constructor(
    override val javaResource: com.pulumi.vault.rabbitMq.SecretBackendRole,
) : KotlinCustomResource(javaResource, SecretBackendRoleMapper) {
    /**
     * The path the RabbitMQ secret backend is mounted at,
     * with no leading or trailing `/`s.
     */
    public val backend: Output
        get() = javaResource.backend().applyValue({ args0 -> args0 })

    /**
     * The name to identify this role within the backend.
     * Must be unique within the backend.
     */
    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) })

    /**
     * Specifies a comma-separated RabbitMQ management tags.
     */
    public val tags: Output?
        get() = javaResource.tags().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies a map of virtual hosts and exchanges to topic permissions. This option requires RabbitMQ 3.7.0 or later.
     */
    public val vhostTopics: Output>?
        get() = javaResource.vhostTopics().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> secretBackendRoleVhostTopicToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Specifies a map of virtual hosts to permissions.
     */
    public val vhosts: Output>?
        get() = javaResource.vhosts().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> secretBackendRoleVhostToKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object SecretBackendRoleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.rabbitMq.SecretBackendRole::class == javaResource::class

    override fun map(javaResource: Resource): SecretBackendRole = SecretBackendRole(
        javaResource as
            com.pulumi.vault.rabbitMq.SecretBackendRole,
    )
}

/**
 * @see [SecretBackendRole].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [SecretBackendRole].
 */
public suspend fun secretBackendRole(
    name: String,
    block: suspend SecretBackendRoleResourceBuilder.() -> Unit,
): SecretBackendRole {
    val builder = SecretBackendRoleResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [SecretBackendRole].
 * @param name The _unique_ name of the resulting resource.
 */
public fun secretBackendRole(name: String): SecretBackendRole {
    val builder = SecretBackendRoleResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy