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

com.pulumi.azure.cosmosdb.kotlin.MongoRoleDefinitionArgs.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.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.cosmosdb.kotlin

import com.pulumi.azure.cosmosdb.MongoRoleDefinitionArgs.builder
import com.pulumi.azure.cosmosdb.kotlin.inputs.MongoRoleDefinitionPrivilegeArgs
import com.pulumi.azure.cosmosdb.kotlin.inputs.MongoRoleDefinitionPrivilegeArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages a Cosmos DB Mongo Role Definition.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.cosmosdb.Account("example", {
 *     name: "example-ca",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     offerType: "Standard",
 *     kind: "MongoDB",
 *     capabilities: [
 *         {
 *             name: "EnableMongo",
 *         },
 *         {
 *             name: "EnableMongoRoleBasedAccessControl",
 *         },
 *     ],
 *     consistencyPolicy: {
 *         consistencyLevel: "Strong",
 *     },
 *     geoLocations: [{
 *         location: example.location,
 *         failoverPriority: 0,
 *     }],
 * });
 * const exampleMongoDatabase = new azure.cosmosdb.MongoDatabase("example", {
 *     name: "example-mongodb",
 *     resourceGroupName: exampleAccount.resourceGroupName,
 *     accountName: exampleAccount.name,
 * });
 * const exampleMongoRoleDefinition = new azure.cosmosdb.MongoRoleDefinition("example", {
 *     cosmosMongoDatabaseId: exampleMongoDatabase.id,
 *     roleName: "example-roledefinition",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_account = azure.cosmosdb.Account("example",
 *     name="example-ca",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     offer_type="Standard",
 *     kind="MongoDB",
 *     capabilities=[
 *         azure.cosmosdb.AccountCapabilityArgs(
 *             name="EnableMongo",
 *         ),
 *         azure.cosmosdb.AccountCapabilityArgs(
 *             name="EnableMongoRoleBasedAccessControl",
 *         ),
 *     ],
 *     consistency_policy=azure.cosmosdb.AccountConsistencyPolicyArgs(
 *         consistency_level="Strong",
 *     ),
 *     geo_locations=[azure.cosmosdb.AccountGeoLocationArgs(
 *         location=example.location,
 *         failover_priority=0,
 *     )])
 * example_mongo_database = azure.cosmosdb.MongoDatabase("example",
 *     name="example-mongodb",
 *     resource_group_name=example_account.resource_group_name,
 *     account_name=example_account.name)
 * example_mongo_role_definition = azure.cosmosdb.MongoRoleDefinition("example",
 *     cosmos_mongo_database_id=example_mongo_database.id,
 *     role_name="example-roledefinition")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.CosmosDB.Account("example", new()
 *     {
 *         Name = "example-ca",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         OfferType = "Standard",
 *         Kind = "MongoDB",
 *         Capabilities = new[]
 *         {
 *             new Azure.CosmosDB.Inputs.AccountCapabilityArgs
 *             {
 *                 Name = "EnableMongo",
 *             },
 *             new Azure.CosmosDB.Inputs.AccountCapabilityArgs
 *             {
 *                 Name = "EnableMongoRoleBasedAccessControl",
 *             },
 *         },
 *         ConsistencyPolicy = new Azure.CosmosDB.Inputs.AccountConsistencyPolicyArgs
 *         {
 *             ConsistencyLevel = "Strong",
 *         },
 *         GeoLocations = new[]
 *         {
 *             new Azure.CosmosDB.Inputs.AccountGeoLocationArgs
 *             {
 *                 Location = example.Location,
 *                 FailoverPriority = 0,
 *             },
 *         },
 *     });
 *     var exampleMongoDatabase = new Azure.CosmosDB.MongoDatabase("example", new()
 *     {
 *         Name = "example-mongodb",
 *         ResourceGroupName = exampleAccount.ResourceGroupName,
 *         AccountName = exampleAccount.Name,
 *     });
 *     var exampleMongoRoleDefinition = new Azure.CosmosDB.MongoRoleDefinition("example", new()
 *     {
 *         CosmosMongoDatabaseId = exampleMongoDatabase.Id,
 *         RoleName = "example-roledefinition",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/cosmosdb"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := cosmosdb.NewAccount(ctx, "example", &cosmosdb.AccountArgs{
 * 			Name:              pulumi.String("example-ca"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			OfferType:         pulumi.String("Standard"),
 * 			Kind:              pulumi.String("MongoDB"),
 * 			Capabilities: cosmosdb.AccountCapabilityArray{
 * 				&cosmosdb.AccountCapabilityArgs{
 * 					Name: pulumi.String("EnableMongo"),
 * 				},
 * 				&cosmosdb.AccountCapabilityArgs{
 * 					Name: pulumi.String("EnableMongoRoleBasedAccessControl"),
 * 				},
 * 			},
 * 			ConsistencyPolicy: &cosmosdb.AccountConsistencyPolicyArgs{
 * 				ConsistencyLevel: pulumi.String("Strong"),
 * 			},
 * 			GeoLocations: cosmosdb.AccountGeoLocationArray{
 * 				&cosmosdb.AccountGeoLocationArgs{
 * 					Location:         example.Location,
 * 					FailoverPriority: pulumi.Int(0),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleMongoDatabase, err := cosmosdb.NewMongoDatabase(ctx, "example", &cosmosdb.MongoDatabaseArgs{
 * 			Name:              pulumi.String("example-mongodb"),
 * 			ResourceGroupName: exampleAccount.ResourceGroupName,
 * 			AccountName:       exampleAccount.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cosmosdb.NewMongoRoleDefinition(ctx, "example", &cosmosdb.MongoRoleDefinitionArgs{
 * 			CosmosMongoDatabaseId: exampleMongoDatabase.ID(),
 * 			RoleName:              pulumi.String("example-roledefinition"),
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.cosmosdb.Account;
 * import com.pulumi.azure.cosmosdb.AccountArgs;
 * import com.pulumi.azure.cosmosdb.inputs.AccountCapabilityArgs;
 * import com.pulumi.azure.cosmosdb.inputs.AccountConsistencyPolicyArgs;
 * import com.pulumi.azure.cosmosdb.inputs.AccountGeoLocationArgs;
 * import com.pulumi.azure.cosmosdb.MongoDatabase;
 * import com.pulumi.azure.cosmosdb.MongoDatabaseArgs;
 * import com.pulumi.azure.cosmosdb.MongoRoleDefinition;
 * import com.pulumi.azure.cosmosdb.MongoRoleDefinitionArgs;
 * 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 ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("example-ca")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .offerType("Standard")
 *             .kind("MongoDB")
 *             .capabilities(
 *                 AccountCapabilityArgs.builder()
 *                     .name("EnableMongo")
 *                     .build(),
 *                 AccountCapabilityArgs.builder()
 *                     .name("EnableMongoRoleBasedAccessControl")
 *                     .build())
 *             .consistencyPolicy(AccountConsistencyPolicyArgs.builder()
 *                 .consistencyLevel("Strong")
 *                 .build())
 *             .geoLocations(AccountGeoLocationArgs.builder()
 *                 .location(example.location())
 *                 .failoverPriority(0)
 *                 .build())
 *             .build());
 *         var exampleMongoDatabase = new MongoDatabase("exampleMongoDatabase", MongoDatabaseArgs.builder()
 *             .name("example-mongodb")
 *             .resourceGroupName(exampleAccount.resourceGroupName())
 *             .accountName(exampleAccount.name())
 *             .build());
 *         var exampleMongoRoleDefinition = new MongoRoleDefinition("exampleMongoRoleDefinition", MongoRoleDefinitionArgs.builder()
 *             .cosmosMongoDatabaseId(exampleMongoDatabase.id())
 *             .roleName("example-roledefinition")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:cosmosdb:Account
 *     name: example
 *     properties:
 *       name: example-ca
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       offerType: Standard
 *       kind: MongoDB
 *       capabilities:
 *         - name: EnableMongo
 *         - name: EnableMongoRoleBasedAccessControl
 *       consistencyPolicy:
 *         consistencyLevel: Strong
 *       geoLocations:
 *         - location: ${example.location}
 *           failoverPriority: 0
 *   exampleMongoDatabase:
 *     type: azure:cosmosdb:MongoDatabase
 *     name: example
 *     properties:
 *       name: example-mongodb
 *       resourceGroupName: ${exampleAccount.resourceGroupName}
 *       accountName: ${exampleAccount.name}
 *   exampleMongoRoleDefinition:
 *     type: azure:cosmosdb:MongoRoleDefinition
 *     name: example
 *     properties:
 *       cosmosMongoDatabaseId: ${exampleMongoDatabase.id}
 *       roleName: example-roledefinition
 * ```
 * 
 * ## Import
 * Cosmos DB Mongo Role Definitions can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:cosmosdb/mongoRoleDefinition:MongoRoleDefinition example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DocumentDB/databaseAccounts/account1/mongodbRoleDefinitions/dbname1.rolename1
 * ```
 * @property cosmosMongoDatabaseId The resource ID of the Mongo DB. Changing this forces a new resource to be created.
 * @property inheritedRoleNames A list of Mongo Roles which are inherited to the Mongo Role Definition.
 * > **Note:** The role that needs to be inherited should exist in the Mongo DB of `cosmos_mongo_database_id`.
 * @property privileges A `privilege` block as defined below.
 * @property roleName The user-friendly name for the Mongo Role Definition. It must be unique for the database account. Changing this forces a new resource to be created.
 */
public data class MongoRoleDefinitionArgs(
    public val cosmosMongoDatabaseId: Output? = null,
    public val inheritedRoleNames: Output>? = null,
    public val privileges: Output>? = null,
    public val roleName: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.cosmosdb.MongoRoleDefinitionArgs =
        com.pulumi.azure.cosmosdb.MongoRoleDefinitionArgs.builder()
            .cosmosMongoDatabaseId(cosmosMongoDatabaseId?.applyValue({ args0 -> args0 }))
            .inheritedRoleNames(inheritedRoleNames?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .privileges(
                privileges?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .roleName(roleName?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [MongoRoleDefinitionArgs].
 */
@PulumiTagMarker
public class MongoRoleDefinitionArgsBuilder internal constructor() {
    private var cosmosMongoDatabaseId: Output? = null

    private var inheritedRoleNames: Output>? = null

    private var privileges: Output>? = null

    private var roleName: Output? = null

    /**
     * @param value The resource ID of the Mongo DB. Changing this forces a new resource to be created.
     */
    @JvmName("apfgcjngdecusmwq")
    public suspend fun cosmosMongoDatabaseId(`value`: Output) {
        this.cosmosMongoDatabaseId = value
    }

    /**
     * @param value A list of Mongo Roles which are inherited to the Mongo Role Definition.
     * > **Note:** The role that needs to be inherited should exist in the Mongo DB of `cosmos_mongo_database_id`.
     */
    @JvmName("adqciodsltsrhywi")
    public suspend fun inheritedRoleNames(`value`: Output>) {
        this.inheritedRoleNames = value
    }

    @JvmName("nejcemtkyuadeouj")
    public suspend fun inheritedRoleNames(vararg values: Output) {
        this.inheritedRoleNames = Output.all(values.asList())
    }

    /**
     * @param values A list of Mongo Roles which are inherited to the Mongo Role Definition.
     * > **Note:** The role that needs to be inherited should exist in the Mongo DB of `cosmos_mongo_database_id`.
     */
    @JvmName("cecohimuabsqrema")
    public suspend fun inheritedRoleNames(values: List>) {
        this.inheritedRoleNames = Output.all(values)
    }

    /**
     * @param value A `privilege` block as defined below.
     */
    @JvmName("cgciwtrxbhrlogje")
    public suspend fun privileges(`value`: Output>) {
        this.privileges = value
    }

    @JvmName("aarxyugwkjccnfly")
    public suspend fun privileges(vararg values: Output) {
        this.privileges = Output.all(values.asList())
    }

    /**
     * @param values A `privilege` block as defined below.
     */
    @JvmName("osgrlkftiktykrtp")
    public suspend fun privileges(values: List>) {
        this.privileges = Output.all(values)
    }

    /**
     * @param value The user-friendly name for the Mongo Role Definition. It must be unique for the database account. Changing this forces a new resource to be created.
     */
    @JvmName("tnkbydxiqmxgcbid")
    public suspend fun roleName(`value`: Output) {
        this.roleName = value
    }

    /**
     * @param value The resource ID of the Mongo DB. Changing this forces a new resource to be created.
     */
    @JvmName("iivxtaxttbmxeafw")
    public suspend fun cosmosMongoDatabaseId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.cosmosMongoDatabaseId = mapped
    }

    /**
     * @param value A list of Mongo Roles which are inherited to the Mongo Role Definition.
     * > **Note:** The role that needs to be inherited should exist in the Mongo DB of `cosmos_mongo_database_id`.
     */
    @JvmName("mkmbbupxmchvkyie")
    public suspend fun inheritedRoleNames(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.inheritedRoleNames = mapped
    }

    /**
     * @param values A list of Mongo Roles which are inherited to the Mongo Role Definition.
     * > **Note:** The role that needs to be inherited should exist in the Mongo DB of `cosmos_mongo_database_id`.
     */
    @JvmName("lkhwgfpqbsbgvmaw")
    public suspend fun inheritedRoleNames(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.inheritedRoleNames = mapped
    }

    /**
     * @param value A `privilege` block as defined below.
     */
    @JvmName("jkbcyoggxexnkntb")
    public suspend fun privileges(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.privileges = mapped
    }

    /**
     * @param argument A `privilege` block as defined below.
     */
    @JvmName("fcyecgqecitwejcr")
    public suspend
    fun privileges(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            MongoRoleDefinitionPrivilegeArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.privileges = mapped
    }

    /**
     * @param argument A `privilege` block as defined below.
     */
    @JvmName("tglqnlpcafqpmyhy")
    public suspend fun privileges(
        vararg
        argument: suspend MongoRoleDefinitionPrivilegeArgsBuilder.() -> Unit,
    ) {
        val toBeMapped = argument.toList().map {
            MongoRoleDefinitionPrivilegeArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.privileges = mapped
    }

    /**
     * @param argument A `privilege` block as defined below.
     */
    @JvmName("efrwmadhcfdfvtoe")
    public suspend
    fun privileges(argument: suspend MongoRoleDefinitionPrivilegeArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            MongoRoleDefinitionPrivilegeArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.privileges = mapped
    }

    /**
     * @param values A `privilege` block as defined below.
     */
    @JvmName("akpfbkmftsmsbtnp")
    public suspend fun privileges(vararg values: MongoRoleDefinitionPrivilegeArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.privileges = mapped
    }

    /**
     * @param value The user-friendly name for the Mongo Role Definition. It must be unique for the database account. Changing this forces a new resource to be created.
     */
    @JvmName("jrberqmowleojqat")
    public suspend fun roleName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.roleName = mapped
    }

    internal fun build(): MongoRoleDefinitionArgs = MongoRoleDefinitionArgs(
        cosmosMongoDatabaseId = cosmosMongoDatabaseId,
        inheritedRoleNames = inheritedRoleNames,
        privileges = privileges,
        roleName = roleName,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy