azure-native.documentdb.MongoDBResourceMongoRoleDefinition

Explore with Pulumi AI

An Azure Cosmos DB Mongo Role Definition. API Version: 2021-10-15-preview.

Example Usage

CosmosDBMongoDBRoleDefinitionCreateUpdate

using System.Collections.Generic;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var mongoDBResourceMongoRoleDefinition = new AzureNative.DocumentDB.MongoDBResourceMongoRoleDefinition("mongoDBResourceMongoRoleDefinition", new()
    {
        AccountName = "myAccountName",
        DatabaseName = "sales",
        MongoRoleDefinitionId = "myMongoRoleDefinitionId",
        Privileges = new[]
        {
            new AzureNative.DocumentDB.Inputs.PrivilegeArgs
            {
                Actions = new[]
                {
                    "insert",
                    "find",
                },
                Resource = new AzureNative.DocumentDB.Inputs.PrivilegeResourceArgs
                {
                    Collection = "sales",
                    Db = "sales",
                },
            },
        },
        ResourceGroupName = "myResourceGroupName",
        RoleName = "myRoleName",
        Roles = new[]
        {
            new AzureNative.DocumentDB.Inputs.RoleArgs
            {
                Db = "sales",
                Role = "myInheritedRole",
            },
        },
    });

});
package main

import (
	documentdb "github.com/pulumi/pulumi-azure-native/sdk/go/azure/documentdb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := documentdb.NewMongoDBResourceMongoRoleDefinition(ctx, "mongoDBResourceMongoRoleDefinition", &documentdb.MongoDBResourceMongoRoleDefinitionArgs{
			AccountName:           pulumi.String("myAccountName"),
			DatabaseName:          pulumi.String("sales"),
			MongoRoleDefinitionId: pulumi.String("myMongoRoleDefinitionId"),
			Privileges: []documentdb.PrivilegeArgs{
				{
					Actions: pulumi.StringArray{
						pulumi.String("insert"),
						pulumi.String("find"),
					},
					Resource: {
						Collection: pulumi.String("sales"),
						Db:         pulumi.String("sales"),
					},
				},
			},
			ResourceGroupName: pulumi.String("myResourceGroupName"),
			RoleName:          pulumi.String("myRoleName"),
			Roles: []documentdb.RoleArgs{
				{
					Db:   pulumi.String("sales"),
					Role: pulumi.String("myInheritedRole"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.documentdb.MongoDBResourceMongoRoleDefinition;
import com.pulumi.azurenative.documentdb.MongoDBResourceMongoRoleDefinitionArgs;
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 mongoDBResourceMongoRoleDefinition = new MongoDBResourceMongoRoleDefinition("mongoDBResourceMongoRoleDefinition", MongoDBResourceMongoRoleDefinitionArgs.builder()        
            .accountName("myAccountName")
            .databaseName("sales")
            .mongoRoleDefinitionId("myMongoRoleDefinitionId")
            .privileges(Map.ofEntries(
                Map.entry("actions",                 
                    "insert",
                    "find"),
                Map.entry("resource", Map.ofEntries(
                    Map.entry("collection", "sales"),
                    Map.entry("db", "sales")
                ))
            ))
            .resourceGroupName("myResourceGroupName")
            .roleName("myRoleName")
            .roles(Map.ofEntries(
                Map.entry("db", "sales"),
                Map.entry("role", "myInheritedRole")
            ))
            .build());

    }
}
import pulumi
import pulumi_azure_native as azure_native

mongo_db_resource_mongo_role_definition = azure_native.documentdb.MongoDBResourceMongoRoleDefinition("mongoDBResourceMongoRoleDefinition",
    account_name="myAccountName",
    database_name="sales",
    mongo_role_definition_id="myMongoRoleDefinitionId",
    privileges=[{
        "actions": [
            "insert",
            "find",
        ],
        "resource": azure_native.documentdb.PrivilegeResourceArgs(
            collection="sales",
            db="sales",
        ),
    }],
    resource_group_name="myResourceGroupName",
    role_name="myRoleName",
    roles=[azure_native.documentdb.RoleArgs(
        db="sales",
        role="myInheritedRole",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const mongoDBResourceMongoRoleDefinition = new azure_native.documentdb.MongoDBResourceMongoRoleDefinition("mongoDBResourceMongoRoleDefinition", {
    accountName: "myAccountName",
    databaseName: "sales",
    mongoRoleDefinitionId: "myMongoRoleDefinitionId",
    privileges: [{
        actions: [
            "insert",
            "find",
        ],
        resource: {
            collection: "sales",
            db: "sales",
        },
    }],
    resourceGroupName: "myResourceGroupName",
    roleName: "myRoleName",
    roles: [{
        db: "sales",
        role: "myInheritedRole",
    }],
});
resources:
  mongoDBResourceMongoRoleDefinition:
    type: azure-native:documentdb:MongoDBResourceMongoRoleDefinition
    properties:
      accountName: myAccountName
      databaseName: sales
      mongoRoleDefinitionId: myMongoRoleDefinitionId
      privileges:
        - actions:
            - insert
            - find
          resource:
            collection: sales
            db: sales
      resourceGroupName: myResourceGroupName
      roleName: myRoleName
      roles:
        - db: sales
          role: myInheritedRole

Create MongoDBResourceMongoRoleDefinition Resource

new MongoDBResourceMongoRoleDefinition(name: string, args: MongoDBResourceMongoRoleDefinitionArgs, opts?: CustomResourceOptions);
@overload
def MongoDBResourceMongoRoleDefinition(resource_name: str,
                                       opts: Optional[ResourceOptions] = None,
                                       account_name: Optional[str] = None,
                                       database_name: Optional[str] = None,
                                       mongo_role_definition_id: Optional[str] = None,
                                       privileges: Optional[Sequence[PrivilegeArgs]] = None,
                                       resource_group_name: Optional[str] = None,
                                       role_name: Optional[str] = None,
                                       roles: Optional[Sequence[RoleArgs]] = None,
                                       type: Optional[MongoRoleDefinitionType] = None)
@overload
def MongoDBResourceMongoRoleDefinition(resource_name: str,
                                       args: MongoDBResourceMongoRoleDefinitionArgs,
                                       opts: Optional[ResourceOptions] = None)
func NewMongoDBResourceMongoRoleDefinition(ctx *Context, name string, args MongoDBResourceMongoRoleDefinitionArgs, opts ...ResourceOption) (*MongoDBResourceMongoRoleDefinition, error)
public MongoDBResourceMongoRoleDefinition(string name, MongoDBResourceMongoRoleDefinitionArgs args, CustomResourceOptions? opts = null)
public MongoDBResourceMongoRoleDefinition(String name, MongoDBResourceMongoRoleDefinitionArgs args)
public MongoDBResourceMongoRoleDefinition(String name, MongoDBResourceMongoRoleDefinitionArgs args, CustomResourceOptions options)
type: azure-native:documentdb:MongoDBResourceMongoRoleDefinition
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args MongoDBResourceMongoRoleDefinitionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args MongoDBResourceMongoRoleDefinitionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args MongoDBResourceMongoRoleDefinitionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args MongoDBResourceMongoRoleDefinitionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args MongoDBResourceMongoRoleDefinitionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

MongoDBResourceMongoRoleDefinition Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The MongoDBResourceMongoRoleDefinition resource accepts the following input properties:

AccountName string

Cosmos DB database account name.

ResourceGroupName string

The name of the resource group. The name is case insensitive.

DatabaseName string

The database name for which access is being granted for this Role Definition.

MongoRoleDefinitionId string

The ID for the Role Definition {dbName.roleName}.

Privileges List<Pulumi.AzureNative.DocumentDB.Inputs.PrivilegeArgs>

A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege.

RoleName string

A user-friendly name for the Role Definition. Must be unique for the database account.

Roles List<Pulumi.AzureNative.DocumentDB.Inputs.RoleArgs>

The set of roles inherited by this Role Definition.

Type Pulumi.AzureNative.DocumentDB.MongoRoleDefinitionType

Indicates whether the Role Definition was built-in or user created.

AccountName string

Cosmos DB database account name.

ResourceGroupName string

The name of the resource group. The name is case insensitive.

DatabaseName string

The database name for which access is being granted for this Role Definition.

MongoRoleDefinitionId string

The ID for the Role Definition {dbName.roleName}.

Privileges []PrivilegeArgs

A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege.

RoleName string

A user-friendly name for the Role Definition. Must be unique for the database account.

Roles []RoleArgs

The set of roles inherited by this Role Definition.

Type MongoRoleDefinitionType

Indicates whether the Role Definition was built-in or user created.

accountName String

Cosmos DB database account name.

resourceGroupName String

The name of the resource group. The name is case insensitive.

databaseName String

The database name for which access is being granted for this Role Definition.

mongoRoleDefinitionId String

The ID for the Role Definition {dbName.roleName}.

privileges List<PrivilegeArgs>

A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege.

roleName String

A user-friendly name for the Role Definition. Must be unique for the database account.

roles List<RoleArgs>

The set of roles inherited by this Role Definition.

type MongoRoleDefinitionType

Indicates whether the Role Definition was built-in or user created.

accountName string

Cosmos DB database account name.

resourceGroupName string

The name of the resource group. The name is case insensitive.

databaseName string

The database name for which access is being granted for this Role Definition.

mongoRoleDefinitionId string

The ID for the Role Definition {dbName.roleName}.

privileges PrivilegeArgs[]

A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege.

roleName string

A user-friendly name for the Role Definition. Must be unique for the database account.

roles RoleArgs[]

The set of roles inherited by this Role Definition.

type MongoRoleDefinitionType

Indicates whether the Role Definition was built-in or user created.

account_name str

Cosmos DB database account name.

resource_group_name str

The name of the resource group. The name is case insensitive.

database_name str

The database name for which access is being granted for this Role Definition.

mongo_role_definition_id str

The ID for the Role Definition {dbName.roleName}.

privileges Sequence[PrivilegeArgs]

A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege.

role_name str

A user-friendly name for the Role Definition. Must be unique for the database account.

roles Sequence[RoleArgs]

The set of roles inherited by this Role Definition.

type MongoRoleDefinitionType

Indicates whether the Role Definition was built-in or user created.

accountName String

Cosmos DB database account name.

resourceGroupName String

The name of the resource group. The name is case insensitive.

databaseName String

The database name for which access is being granted for this Role Definition.

mongoRoleDefinitionId String

The ID for the Role Definition {dbName.roleName}.

privileges List<Property Map>

A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege.

roleName String

A user-friendly name for the Role Definition. Must be unique for the database account.

roles List<Property Map>

The set of roles inherited by this Role Definition.

type "BuiltInRole" | "CustomRole"

Indicates whether the Role Definition was built-in or user created.

Outputs

All input properties are implicitly available as output properties. Additionally, the MongoDBResourceMongoRoleDefinition resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Name string

The name of the database account.

Id string

The provider-assigned unique ID for this managed resource.

Name string

The name of the database account.

id String

The provider-assigned unique ID for this managed resource.

name String

The name of the database account.

id string

The provider-assigned unique ID for this managed resource.

name string

The name of the database account.

id str

The provider-assigned unique ID for this managed resource.

name str

The name of the database account.

id String

The provider-assigned unique ID for this managed resource.

name String

The name of the database account.

Supporting Types

MongoRoleDefinitionType

BuiltInRole
BuiltInRole
CustomRole
CustomRole
MongoRoleDefinitionTypeBuiltInRole
BuiltInRole
MongoRoleDefinitionTypeCustomRole
CustomRole
BuiltInRole
BuiltInRole
CustomRole
CustomRole
BuiltInRole
BuiltInRole
CustomRole
CustomRole
BUILT_IN_ROLE
BuiltInRole
CUSTOM_ROLE
CustomRole
"BuiltInRole"
BuiltInRole
"CustomRole"
CustomRole

Privilege

Actions List<string>

An array of actions that are allowed.

Resource Pulumi.AzureNative.DocumentDB.Inputs.PrivilegeResource

An Azure Cosmos DB Mongo DB Resource.

Actions []string

An array of actions that are allowed.

Resource PrivilegeResource

An Azure Cosmos DB Mongo DB Resource.

actions List<String>

An array of actions that are allowed.

resource PrivilegeResource

An Azure Cosmos DB Mongo DB Resource.

actions string[]

An array of actions that are allowed.

resource PrivilegeResource

An Azure Cosmos DB Mongo DB Resource.

actions Sequence[str]

An array of actions that are allowed.

resource PrivilegeResource

An Azure Cosmos DB Mongo DB Resource.

actions List<String>

An array of actions that are allowed.

resource Property Map

An Azure Cosmos DB Mongo DB Resource.

PrivilegeResource

Collection string

The collection name the role is applied.

Db string

The database name the role is applied.

Collection string

The collection name the role is applied.

Db string

The database name the role is applied.

collection String

The collection name the role is applied.

db String

The database name the role is applied.

collection string

The collection name the role is applied.

db string

The database name the role is applied.

collection str

The collection name the role is applied.

db str

The database name the role is applied.

collection String

The collection name the role is applied.

db String

The database name the role is applied.

PrivilegeResponse

Actions List<string>

An array of actions that are allowed.

Resource Pulumi.AzureNative.DocumentDB.Inputs.PrivilegeResponseResource

An Azure Cosmos DB Mongo DB Resource.

Actions []string

An array of actions that are allowed.

Resource PrivilegeResponseResource

An Azure Cosmos DB Mongo DB Resource.

actions List<String>

An array of actions that are allowed.

resource PrivilegeResponseResource

An Azure Cosmos DB Mongo DB Resource.

actions string[]

An array of actions that are allowed.

resource PrivilegeResponseResource

An Azure Cosmos DB Mongo DB Resource.

actions Sequence[str]

An array of actions that are allowed.

resource PrivilegeResponseResource

An Azure Cosmos DB Mongo DB Resource.

actions List<String>

An array of actions that are allowed.

resource Property Map

An Azure Cosmos DB Mongo DB Resource.

PrivilegeResponseResource

Collection string

The collection name the role is applied.

Db string

The database name the role is applied.

Collection string

The collection name the role is applied.

Db string

The database name the role is applied.

collection String

The collection name the role is applied.

db String

The database name the role is applied.

collection string

The collection name the role is applied.

db string

The database name the role is applied.

collection str

The collection name the role is applied.

db str

The database name the role is applied.

collection String

The collection name the role is applied.

db String

The database name the role is applied.

Role

Db string

The database name the role is applied.

Role string

The role name.

Db string

The database name the role is applied.

Role string

The role name.

db String

The database name the role is applied.

role String

The role name.

db string

The database name the role is applied.

role string

The role name.

db str

The database name the role is applied.

role str

The role name.

db String

The database name the role is applied.

role String

The role name.

RoleResponse

Db string

The database name the role is applied.

Role string

The role name.

Db string

The database name the role is applied.

Role string

The role name.

db String

The database name the role is applied.

role String

The role name.

db string

The database name the role is applied.

role string

The role name.

db str

The database name the role is applied.

role str

The role name.

db String

The database name the role is applied.

role String

The role name.

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:documentdb:MongoDBResourceMongoRoleDefinition myMongoDbRoleDefinitionId /subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/mongodbRoleDefinitions/myMongoDbRoleDefinitionId 

Package Details

Repository
Azure Native pulumi/pulumi-azure-native
License
Apache-2.0