azure-native.documentdb.MongoDBResourceMongoRoleDefinition
Explore with Pulumi AI
An Azure Cosmos DB Mongo Role Definition. Azure REST API version: 2023-04-15. Prior API version in Azure Native 1.x: 2021-10-15-preview.
Other available API versions: 2023-03-01-preview, 2023-09-15, 2023-09-15-preview, 2023-11-15, 2023-11-15-preview, 2024-02-15-preview, 2024-05-15, 2024-05-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/v2"
"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.PrivilegeArray{
&documentdb.PrivilegeArgs{
Actions: pulumi.StringArray{
pulumi.String("insert"),
pulumi.String("find"),
},
Resource: &documentdb.PrivilegeResourceArgs{
Collection: pulumi.String("sales"),
Db: pulumi.String("sales"),
},
},
},
ResourceGroupName: pulumi.String("myResourceGroupName"),
RoleName: pulumi.String("myRoleName"),
Roles: documentdb.RoleArray{
&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 com.pulumi.azurenative.documentdb.inputs.PrivilegeArgs;
import com.pulumi.azurenative.documentdb.inputs.PrivilegeResourceArgs;
import com.pulumi.azurenative.documentdb.inputs.RoleArgs;
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(PrivilegeArgs.builder()
.actions(
"insert",
"find")
.resource(PrivilegeResourceArgs.builder()
.collection("sales")
.db("sales")
.build())
.build())
.resourceGroupName("myResourceGroupName")
.roleName("myRoleName")
.roles(RoleArgs.builder()
.db("sales")
.role("myInheritedRole")
.build())
.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=[azure_native.documentdb.PrivilegeArgs(
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[]
{
new AzureNative.DocumentDB.Inputs.PrivilegeArgs
{
Actions = new[]
{
"string",
},
Resource = new AzureNative.DocumentDB.Inputs.PrivilegeResourceArgs
{
Collection = "string",
Db = "string",
},
},
},
RoleName = "string",
Roles = new[]
{
new AzureNative.DocumentDB.Inputs.RoleArgs
{
Db = "string",
Role = "string",
},
},
Type = AzureNative.DocumentDB.MongoRoleDefinitionType.BuiltInRole,
});
example, err := documentdb.NewMongoDBResourceMongoRoleDefinition(ctx, "mongoDBResourceMongoRoleDefinitionResource", &documentdb.MongoDBResourceMongoRoleDefinitionArgs{
AccountName: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
DatabaseName: pulumi.String("string"),
MongoRoleDefinitionId: pulumi.String("string"),
Privileges: documentdb.PrivilegeArray{
&documentdb.PrivilegeArgs{
Actions: pulumi.StringArray{
pulumi.String("string"),
},
Resource: &documentdb.PrivilegeResourceArgs{
Collection: pulumi.String("string"),
Db: pulumi.String("string"),
},
},
},
RoleName: pulumi.String("string"),
Roles: documentdb.RoleArray{
&documentdb.RoleArgs{
Db: pulumi.String("string"),
Role: pulumi.String("string"),
},
},
Type: documentdb.MongoRoleDefinitionTypeBuiltInRole,
})
var mongoDBResourceMongoRoleDefinitionResource = new MongoDBResourceMongoRoleDefinition("mongoDBResourceMongoRoleDefinitionResource", MongoDBResourceMongoRoleDefinitionArgs.builder()
.accountName("string")
.resourceGroupName("string")
.databaseName("string")
.mongoRoleDefinitionId("string")
.privileges(PrivilegeArgs.builder()
.actions("string")
.resource(PrivilegeResourceArgs.builder()
.collection("string")
.db("string")
.build())
.build())
.roleName("string")
.roles(RoleArgs.builder()
.db("string")
.role("string")
.build())
.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=[azure_native.documentdb.PrivilegeArgs(
actions=["string"],
resource=azure_native.documentdb.PrivilegeResourceArgs(
collection="string",
db="string",
),
)],
role_name="string",
roles=[azure_native.documentdb.RoleArgs(
db="string",
role="string",
)],
type=azure_native.documentdb.MongoRoleDefinitionType.BUILT_IN_ROLE)
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: azure_native.documentdb.MongoRoleDefinitionType.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
The MongoDBResourceMongoRoleDefinition resource accepts the following input properties:
- Account
Name string - Cosmos DB database account name.
- Resource
Group stringName - The name of the resource group. The name is case insensitive.
- Database
Name string - The database name for which access is being granted for this Role Definition.
- Mongo
Role stringDefinition Id - The ID for the Role Definition {dbName.roleName}.
- Privileges
List<Pulumi.
Azure Native. Document DB. 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.
- Role
Name string - A user-friendly name for the Role Definition. Must be unique for the database account.
- Roles
List<Pulumi.
Azure Native. Document DB. Inputs. Role> - The set of roles inherited by this Role Definition.
- Type
Pulumi.
Azure Native. Document DB. Mongo Role Definition Type - Indicates whether the Role Definition was built-in or user created.
- Account
Name string - Cosmos DB database account name.
- Resource
Group stringName - The name of the resource group. The name is case insensitive.
- Database
Name string - The database name for which access is being granted for this Role Definition.
- Mongo
Role stringDefinition Id - The ID for the Role Definition {dbName.roleName}.
- Privileges
[]Privilege
Args - 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 string - A user-friendly name for the Role Definition. Must be unique for the database account.
- Roles
[]Role
Args - The set of roles inherited by this Role Definition.
- Type
Mongo
Role Definition Type - Indicates whether the Role Definition was built-in or user created.
- account
Name String - Cosmos DB database account name.
- resource
Group StringName - The name of the resource group. The name is case insensitive.
- database
Name String - The database name for which access is being granted for this Role Definition.
- mongo
Role StringDefinition Id - 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.
- role
Name 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
Mongo
Role Definition Type - Indicates whether the Role Definition was built-in or user created.
- account
Name string - Cosmos DB database account name.
- resource
Group stringName - The name of the resource group. The name is case insensitive.
- database
Name string - The database name for which access is being granted for this Role Definition.
- mongo
Role stringDefinition Id - 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.
- role
Name 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
Mongo
Role Definition Type - Indicates whether the Role Definition was built-in or user created.
- account_
name str - Cosmos DB database account name.
- resource_
group_ strname - 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_ strdefinition_ id - The ID for the Role Definition {dbName.roleName}.
- privileges
Sequence[Privilege
Args] - 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[Role
Args] - The set of roles inherited by this Role Definition.
- type
Mongo
Role Definition Type - Indicates whether the Role Definition was built-in or user created.
- account
Name String - Cosmos DB database account name.
- resource
Group StringName - The name of the resource group. The name is case insensitive.
- database
Name String - The database name for which access is being granted for this Role Definition.
- mongo
Role StringDefinition Id - 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.
- role
Name 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
"Built
In Role" | "Custom Role" - 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:
Supporting Types
MongoRoleDefinitionType, MongoRoleDefinitionTypeArgs
- Built
In Role - BuiltInRole
- Custom
Role - CustomRole
- Mongo
Role Definition Type Built In Role - BuiltInRole
- Mongo
Role Definition Type Custom Role - CustomRole
- Built
In Role - BuiltInRole
- Custom
Role - CustomRole
- Built
In Role - BuiltInRole
- Custom
Role - CustomRole
- BUILT_IN_ROLE
- BuiltInRole
- CUSTOM_ROLE
- CustomRole
- "Built
In Role" - BuiltInRole
- "Custom
Role" - CustomRole
Privilege, PrivilegeArgs
- Actions List<string>
- An array of actions that are allowed.
- Resource
Pulumi.
Azure Native. Document DB. Inputs. Privilege Resource - An Azure Cosmos DB Mongo DB Resource.
- Actions []string
- An array of actions that are allowed.
- Resource
Privilege
Resource - An Azure Cosmos DB Mongo DB Resource.
- actions List<String>
- An array of actions that are allowed.
- resource
Privilege
Resource - An Azure Cosmos DB Mongo DB Resource.
- actions string[]
- An array of actions that are allowed.
- resource
Privilege
Resource - An Azure Cosmos DB Mongo DB Resource.
- actions Sequence[str]
- An array of actions that are allowed.
- resource
Privilege
Resource - 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.
Azure Native. Document DB. Inputs. Privilege Response Resource - An Azure Cosmos DB Mongo DB Resource.
- Actions []string
- An array of actions that are allowed.
- Resource
Privilege
Response Resource - An Azure Cosmos DB Mongo DB Resource.
- actions List<String>
- An array of actions that are allowed.
- resource
Privilege
Response Resource - An Azure Cosmos DB Mongo DB Resource.
- actions string[]
- An array of actions that are allowed.
- resource
Privilege
Response Resource - An Azure Cosmos DB Mongo DB Resource.
- actions Sequence[str]
- An array of actions that are allowed.
- resource
Privilege
Response Resource - 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
RoleResponse, RoleResponseArgs
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:documentdb:MongoDBResourceMongoRoleDefinition myMongoDbRoleDefinitionId /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Native pulumi/pulumi-azure-native
- License
- Apache-2.0