Table of Contents

Class PermissionProperties

Namespace
Microsoft.Azure.Cosmos
Assembly
Microsoft.Azure.Cosmos.Client.dll

Represents a permission in the Azure Cosmos DB service.

public class PermissionProperties
Inheritance
PermissionProperties
Inherited Members
Extension Methods

Constructors

PermissionProperties(string, PermissionMode, Container, PartitionKey, string)

Initialize a new instance of the PermissionProperties with permission to Cosmos item.

public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId)

Parameters

id string

The permission id.

permissionMode PermissionMode

The PermissionMode.

container Container

The Container object.

resourcePartitionKey PartitionKey

The PartitionKey of the resource in the Azure Cosmos service.

itemId string

The cosmos item id

PermissionProperties(string, PermissionMode, Container, PartitionKey?)

Initialize a new instance of the PermissionProperties with permission to Container.

public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey? resourcePartitionKey = null)

Parameters

id string

The permission id.

permissionMode PermissionMode

The PermissionMode.

container Container

The Container object.

resourcePartitionKey PartitionKey?

(Optional) The partition key value for the permission in the Azure Cosmos DB service.

Properties

ETag

Gets the entity tag associated with the resource from the Azure Cosmos DB service.

public string ETag { get; }

Property Value

string

The entity tag associated with the resource.

Remarks

ETags are used for concurrency checking when updating resources.

Id

Gets the Id of the resource in the Azure Cosmos DB service.

public string Id { get; }

Property Value

string

The Id associated with the resource.

Remarks

Every resource within an Azure Cosmos DB database account needs to have a unique identifier.

The following characters are restricted and cannot be used in the Id property: '/', '\\', '?', '#'

LastModified

Gets the last modified time stamp associated with PermissionProperties from the Azure Cosmos DB service.

public DateTime? LastModified { get; }

Property Value

DateTime?

The last modified time stamp associated with the resource.

Remarks

ResourceToken generation and reading does not apply.

PermissionMode

Gets the permission mode in the Azure Cosmos DB service.

public PermissionMode PermissionMode { get; }

Property Value

PermissionMode

The PermissionMode mode: Read or All.

ResourcePartitionKey

Gets optional partition key value for the permission in the Azure Cosmos DB service. A permission applies to resources when two conditions are met: 1. ResourceUri is prefix of resource's link. For example "/dbs/mydatabase/colls/mycollection" applies to "/dbs/mydatabase/colls/mycollection" and "/dbs/mydatabase/colls/mycollection/docs/mydocument" 2. ResourcePartitionKey is superset of resource's partition key. For example absent/empty partition key is superset of all partition keys.

public PartitionKey? ResourcePartitionKey { get; set; }

Property Value

PartitionKey?

ResourceUri

Gets the self-uri of resource to which the permission applies in the Azure Cosmos DB service.

public string ResourceUri { get; }

Property Value

string

The-uri of the resource to which the permission applies.

Gets the self-link associated with the resource from the Azure Cosmos DB service.

public string SelfLink { get; }

Property Value

string

The self-link associated with the resource.

A self-link is a static addressable Uri for each resource within a database account and follows the Azure Cosmos DB resource model. E.g. a self-link for a document could be dbs/db_resourceid/colls/coll_resourceid/documents/doc_resourceid

Token

Gets the access token granting the defined permission from the Azure Cosmos DB service.

public string Token { get; }

Property Value

string

The access token granting the defined permission.