com.microsoft.azure.cosmosdb

This package provides Java SDK Common Resources for Azure Cosmos DB.

Classes

AccessCondition

Represents a set of access conditions to be used for operations against the Azure Cosmos DB database service.

Attachment

Represents a document attachment in the Azure Cosmos DB database service.

Each document may contain zero or more attachments. Attachments can be of any MIME type - text, image, binary data. These are stored externally in Azure Blob storage. Attachments are automatically deleted when the parent document is deleted.

BridgeInternal

This is meant to be used only internally as a bridge access to classes in com.microsoft.azure.cosmosdb

ChangeFeedOptions

Specifies the options associated with change feed methods (enumeration operations) in the Azure Cosmos DB database service.

ClientSideRequestStatistics
CommonsBridgeInternal
CompositePath

Represents a composite path of the IndexingPolicy in the Azure Cosmos DB database service. A composite path is used in a composite index. For example if you want to run a query like "SELECT * FROM c ORDER BY c.age, c.height", then you need to add "/age" and "/height" as composite paths to your composite index.

Conflict

Represents a conflict in the version of a particular resource in the Azure Cosmos DB database service.

During rare failure scenarios, conflicts are generated for the documents in transit. Clients can inspect the respective conflict instances for resources and operations in conflict.

ConflictResolutionPolicy

Represents the conflict resolution policy configuration for specifying how to resolve conflicts in case writes from different regions result in conflicts on documents in the collection in the Azure Cosmos DB service.

A collection with custom conflict resolution with no user-registered stored procedure.

DocumentCollection collectionSpec = new DocumentCollection();
    collectionSpec.setId("Multi-master collection");
    
    ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy();
    collectionSpec.setConflictResolutionPolicy(policy);
    
    DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
            .toBlocking().single().getResource();
    

A collection with custom conflict resolution with a user-registered stored procedure.

DocumentCollection collectionSpec = new DocumentCollection();
    collectionSpec.setId("Multi-master collection");
    
    ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy(conflictResolutionSprocName);
    collectionSpec.setConflictResolutionPolicy(policy);
    
    DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
            .toBlocking().single().getResource();
    

A collection with last writer wins conflict resolution, based on a path in the conflicting documents. A collection with custom conflict resolution with a user-registered stored procedure.

DocumentCollection collectionSpec = new DocumentCollection();
    collectionSpec.setId("Multi-master collection");
    
    ConflictResolutionPolicy policy = ConflictResolutionPolicy.createLastWriterWinsPolicy("/path/for/conflict/resolution");
    collectionSpec.setConflictResolutionPolicy(policy);
    
    DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
            .toBlocking().single().getResource();
    

ConnectionPolicy

Represents the Connection policy associated with a DocumentClient in the Azure Cosmos DB database service.

ConsistencyPolicy

Encapsulates the settings for consistency policy in the Azure Cosmos DB database service.

Database

Represents a Database in the Azure Cosmos DB database service. A database manages users, permissions and a set of collections

Each Azure Cosmos DB Service is able to support multiple independent named databases, with the database being the logical container for data. Each Database consists of one or more collections, each of which in turn contain one or more documents. Since databases are an an administrative resource and the Service Master Key will be required in order to access and successfully complete any action using the User APIs.

DatabaseAccount

Represents a database account in the Azure Cosmos DB database service.

DatabaseAccountLocation

Represents the location of a database account in the Azure Cosmos DB database service.

Document

Represents a document in the Azure Cosmos DB database service.

A document is a structured JSON document. There is no set schema for the JSON documents, and a document may contain any number of custom properties as well as an optional list of attachments. Document is an application resource and can be authorized using the master key or resource keys.

DocumentClientException

This class defines a custom exception type for all operations on DocumentClient in the Azure Cosmos DB database service. Applications are expected to catch DocumentClientException and handle errors as appropriate when calling methods on DocumentClient.

Errors coming from the service during normal execution are converted to DocumentClientException before returning to the application with the following exception:

When a BE error is encountered during a QueryIterable<T> iteration, an IllegalStateException is thrown instead of DocumentClientException.

When a transport level error happens that request is not able to reach the service, an IllegalStateException is thrown instead of DocumentClientException.

DocumentCollection

Represents a document collection in the Azure Cosmos DB database service. A collection is a named logical container for documents.

A database may contain zero or more named collections and each collection consists of zero or more JSON documents. Being schema-free, the documents in a collection do not need to share the same structure or fields. Since collections are application resources, they can be authorized using either the master key or resource keys.

Error

Encapsulates error related details in the Azure Cosmos DB database service.

ExcludedPath

Represents an excluded path of the IndexingPolicy in the Azure Cosmos DB database service.

FeedOptions

Specifies the options associated with feed methods (enumeration operations) in the Azure Cosmos DB database service.

FeedOptionsBase

Specifies the common options associated with feed methods (enumeration operations) in the Azure Cosmos DB database service.

FeedResponse<T>
HashIndex

Represents a hash index in the Azure Cosmos DB database service.

IncludedPath

Represents an included path of the IndexingPolicy in the Azure Cosmos DB database service.

Index

Represents the index of a collection in the Azure Cosmos DB database service.

IndexingPolicy

Represents the indexing policy configuration for a collection in the Azure Cosmos DB database service.

JsonSerializable

Represents a base resource that can be serialized to JSON in the Azure Cosmos DB database service.

MediaOptions

Options used with attachment content (aka media) creation in the Azure Cosmos DB database service.

MediaResponse

Response associated with retrieving attachment content in the Azure Cosmos DB database service.

Offer

Represents an offer in the Azure Cosmos DB database service.

PartitionKey

Represents a partition key value in the Azure Cosmos DB database service. A partition key identifies the partition where the document is stored in.

PartitionKeyDefinition

Represents a partition key definition in the Azure Cosmos DB database service. A partition key definition specifies which document property is used as the partition key in a collection that has multiple partitions.

PartitionKeyRange

Represent a partition key range in the Azure Cosmos DB database service.

Permission

Represents a per-User Permission to access a specific resource e.g. Document or Collection in the Azure Cosmos DB database service.

QueryMetrics

Query metrics in the Azure Cosmos database service. This metric represents a moving average for a set of queries whose metrics have been aggregated together.

QueryMetricsConstants
QueryPreparationTimes
RangeIndex

Represents a range index in the Azure Cosmos DB database service.

ReplicationPolicy

Encapsulates the replication policy in the Azure Cosmos DB database service.

RequestOptions

Encapsulates options that can be specified for a request issued to the Azure Cosmos DB database service.

Resource

Represents the base resource in the Azure Cosmos DB database service.

ResourceResponse<T>

Represents the service response to a request made from DocumentClient in the Azure Cosmos DB database service. Contains both the resource and the response headers.

RetryOptions

Encapsulates retry options in the Azure Cosmos DB database service.

RuntimeExecutionTimes

Query runtime execution times in the Azure Cosmos DB service.

SpatialIndex

Represents a spatial index in the Azure Cosmos DB database service.

SpatialSpec
SqlParameter

Represents a SQL parameter in the SqlQuerySpec used for queries in the Azure Cosmos DB database service.

SqlParameterCollection

Represents a collection of SQL parameters to for a SQL query in the Azure Cosmos DB database service.

SqlQuerySpec

Represents a SQL query in the Azure Cosmos DB database service.

StoredProcedure

Represents a stored procedure in the Azure Cosmos DB database service.

Cosmos DB allows stored procedures to be executed in the storage tier, directly against a document collection. The script gets executed under ACID transactions on the primary storage partition of the specified collection. For additional details, refer to the server-side JavaScript API documentation.

StoredProcedureResponse

Represents the response returned from a stored procedure in the Azure Cosmos DB database service. Wraps the response body and headers.

Trigger

Represents a trigger in the Azure Cosmos DB database service.

Cosmos DB supports pre and post triggers defined in JavaScript to be executed on creates, updates and deletes. For additional details, refer to the server-side JavaScript API documentation.

Undefined

Represents the 'Undefined' partition key in the Azure Cosmos DB database service.

UniqueKey

Represents a unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service.

1) For partitioned collections, the value of partition key is implicitly a part of each unique key. 2) Uniqueness constraint is also enforced for missing values. For instance, if unique key policy defines a unique key with single property path, there could be only one document that has missing value for this property.

UniqueKeyPolicy

Represents the unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service.

User

Represents a database user in the Azure Cosmos DB database service.

UserDefinedFunction

Represents a user defined function in the Azure Cosmos DB database service.

Cosmos DB supports JavaScript UDFs which can be used inside queries, stored procedures and triggers. For additional details, refer to the server-side JavaScript API documentation.

Interfaces

DatabaseAccountManagerInternal
ISessionContainer
TokenResolver

This interface is for client side implementation, which can be used for initializing AsyncDocumentClient without passing master key, resource token and permission feed.

Each time the SDK create request for CosmosDB, authorization token is generated based on that request at client side which enables creation of one AsyncDocumentClient per application shared across various users with different resource permissions.

Enums

AccessConditionType

Specifies the set of access condition types that can be used for operations in the Azure Cosmos DB database service.

CompositePathSortOrder

Represents the sorting order for a path in a composite index, for a collection in the Azure Cosmos DB database service.

ConflictResolutionMode
ConnectionMode

Represents the connection mode to be used by the client in the Azure Cosmos DB database service.

Direct and Gateway connectivity modes are supported. Gateway is the default. Refer to <see>http://azure.microsoft.com/documentation/articles/documentdb- interactions-with-resources/connectivity-options</see> for additional details.

ConsistencyLevel

Represents the consistency levels supported for Cosmos DB client operations in the Azure Cosmos DB database service.

The requested ConsistencyLevel must match or be weaker than that provisioned for the database account. Consistency levels by order of strength are Strong, BoundedStaleness, Session, ConsistentPrefix and Eventual.

CosmosResourceType

Resource types in the Azure Cosmos DB database service.

DataType

Data types in the Azure Cosmos DB database service.

IndexingDirective

Specifies whether or not the resource is to be indexed in the Azure Cosmos DB database service.

IndexingMode

Specifies the supported indexing modes in the Azure Cosmos DB database service.

IndexKind

These are the indexing types available for indexing a path in the Azure Cosmos DB database service. For additional details, refer to http://azure.microsoft.com/documentation/articles/documentdb-indexing-policies/#ConfigPolicy.

MediaReadMode

Represents the mode for use with downloading attachment content (aka media) from the Azure Cosmos DB database service.

PartitionKeyDefinitionVersion

Partitioning version.

PartitionKind

Specifies the partition scheme for an multiple-partitioned collection in the Azure Cosmos DB database service.

PermissionMode

Enumeration specifying applicability of permission in the Azure Cosmos DB database service.

SerializationFormattingPolicy

The formatting policy associated with JSON serialization in the Azure Cosmos DB database service.

SpatialType

Defines the target data type of an index path specification in the Azure Cosmos DB service.

TriggerOperation

Specifies the operations on which a trigger should be executed in the Azure Cosmos DB database service.

TriggerType

The trigger type in the Azure Cosmos DB database service.