1. Packages
  2. Azure Native v1
  3. API Docs
  4. documentdb
  5. MongoDBResourceMongoRoleDefinition
These are the docs for Azure Native v1. We recommenend using the latest version, Azure Native v2.
Azure Native v1 v1.104.0 published on Thursday, Jul 6, 2023 by Pulumi

azure-native.documentdb.MongoDBResourceMongoRoleDefinition

Explore with Pulumi AI

azure-native-v1 logo
These are the docs for Azure Native v1. We recommenend using the latest version, Azure Native v2.
Azure Native v1 v1.104.0 published on Thursday, Jul 6, 2023 by Pulumi

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

    Example Usage

    CosmosDBMongoDBRoleDefinitionCreateUpdate

    using System.Collections.Generic;
    using System.Linq;
    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/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

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new MongoDBResourceMongoRoleDefinition(name: string, args: MongoDBResourceMongoRoleDefinitionArgs, opts?: CustomResourceOptions);
    @overload
    def MongoDBResourceMongoRoleDefinition(resource_name: str,
                                           args: MongoDBResourceMongoRoleDefinitionArgs,
                                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def MongoDBResourceMongoRoleDefinition(resource_name: str,
                                           opts: Optional[ResourceOptions] = None,
                                           account_name: Optional[str] = None,
                                           resource_group_name: Optional[str] = None,
                                           database_name: Optional[str] = None,
                                           mongo_role_definition_id: Optional[str] = None,
                                           privileges: Optional[Sequence[PrivilegeArgs]] = None,
                                           role_name: Optional[str] = None,
                                           roles: Optional[Sequence[RoleArgs]] = None,
                                           type: Optional[MongoRoleDefinitionType] = 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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var mongoDBResourceMongoRoleDefinitionResource = new AzureNative.Documentdb.MongoDBResourceMongoRoleDefinition("mongoDBResourceMongoRoleDefinitionResource", new()
    {
        AccountName = "string",
        ResourceGroupName = "string",
        DatabaseName = "string",
        MongoRoleDefinitionId = "string",
        Privileges = new[]
        {
            
            {
                { "actions", new[]
                {
                    "string",
                } },
                { "resource", 
                {
                    { "collection", "string" },
                    { "db", "string" },
                } },
            },
        },
        RoleName = "string",
        Roles = new[]
        {
            
            {
                { "db", "string" },
                { "role", "string" },
            },
        },
        Type = "BuiltInRole",
    });
    
    example, err := documentdb.NewMongoDBResourceMongoRoleDefinition(ctx, "mongoDBResourceMongoRoleDefinitionResource", &documentdb.MongoDBResourceMongoRoleDefinitionArgs{
    	AccountName:           "string",
    	ResourceGroupName:     "string",
    	DatabaseName:          "string",
    	MongoRoleDefinitionId: "string",
    	Privileges: []map[string]interface{}{
    		map[string]interface{}{
    			"actions": []string{
    				"string",
    			},
    			"resource": map[string]interface{}{
    				"collection": "string",
    				"db":         "string",
    			},
    		},
    	},
    	RoleName: "string",
    	Roles: []map[string]interface{}{
    		map[string]interface{}{
    			"db":   "string",
    			"role": "string",
    		},
    	},
    	Type: "BuiltInRole",
    })
    
    var mongoDBResourceMongoRoleDefinitionResource = new MongoDBResourceMongoRoleDefinition("mongoDBResourceMongoRoleDefinitionResource", MongoDBResourceMongoRoleDefinitionArgs.builder()
        .accountName("string")
        .resourceGroupName("string")
        .databaseName("string")
        .mongoRoleDefinitionId("string")
        .privileges(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
        .roleName("string")
        .roles(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
        .type("BuiltInRole")
        .build());
    
    mongo_db_resource_mongo_role_definition_resource = azure_native.documentdb.MongoDBResourceMongoRoleDefinition("mongoDBResourceMongoRoleDefinitionResource",
        account_name=string,
        resource_group_name=string,
        database_name=string,
        mongo_role_definition_id=string,
        privileges=[{
            actions: [string],
            resource: {
                collection: string,
                db: string,
            },
        }],
        role_name=string,
        roles=[{
            db: string,
            role: string,
        }],
        type=BuiltInRole)
    
    const mongoDBResourceMongoRoleDefinitionResource = new azure_native.documentdb.MongoDBResourceMongoRoleDefinition("mongoDBResourceMongoRoleDefinitionResource", {
        accountName: "string",
        resourceGroupName: "string",
        databaseName: "string",
        mongoRoleDefinitionId: "string",
        privileges: [{
            actions: ["string"],
            resource: {
                collection: "string",
                db: "string",
            },
        }],
        roleName: "string",
        roles: [{
            db: "string",
            role: "string",
        }],
        type: "BuiltInRole",
    });
    
    type: azure-native:documentdb:MongoDBResourceMongoRoleDefinition
    properties:
        accountName: string
        databaseName: string
        mongoRoleDefinitionId: string
        privileges:
            - actions:
                - string
              resource:
                collection: string
                db: string
        resourceGroupName: string
        roleName: string
        roles:
            - db: string
              role: string
        type: BuiltInRole
    

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    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.Privilege>
    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.Role>
    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<Privilege>
    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<Role>
    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 Privilege[]
    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 Role[]
    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, MongoRoleDefinitionTypeArgs

    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, PrivilegeArgs

    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, PrivilegeResourceArgs

    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, PrivilegeResponseArgs

    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, PrivilegeResponseResourceArgs

    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, RoleArgs

    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, RoleResponseArgs

    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 
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    azure-native-v1 pulumi/pulumi-azure-native
    License
    Apache-2.0
    azure-native-v1 logo
    These are the docs for Azure Native v1. We recommenend using the latest version, Azure Native v2.
    Azure Native v1 v1.104.0 published on Thursday, Jul 6, 2023 by Pulumi