collection
Creates, updates, deletes, gets or lists a collection resource.
Overview
| Name | collection |
| Type | Resource |
| Id | azure.cosmosdb.collection |
Fields
The following fields are returned by SELECT queries:
- list_metrics
- list_usages
| Name | Datatype | Description |
|---|---|---|
name | object | The name information for the metric. |
endTime | string (date-time) | The end time for the metric (ISO-8601 format). |
metricValues | array | The metric values for the specified time window and timestep. |
startTime | string (date-time) | The start time for the metric (ISO-8601 format). |
timeGrain | string | The time grain to be used to summarize the metric values. |
unit | string | The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", "CountPerSecond", "BytesPerSecond", and "Milliseconds". (Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond, Milliseconds) |
| Name | Datatype | Description |
|---|---|---|
name | object | The name information for the metric. |
currentValue | integer | Current value for this metric. |
limit | integer | Maximum value for this metric. |
quotaPeriod | string | The quota period used to summarize the usage values. |
unit | string | The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", "CountPerSecond", "BytesPerSecond", and "Milliseconds". (Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond, Milliseconds) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_metrics | select | resource_group_name, account_name, database_rid, collection_rid, subscription_id, $filter | Retrieves the metrics determined by the given filter for the given database account and collection. | |
list_usages | select | resource_group_name, account_name, database_rid, collection_rid, subscription_id | $filter | Retrieves the usages (most recent storage data) for the given collection. |
list_metric_definitions | exec | resource_group_name, account_name, database_rid, collection_rid, subscription_id | Retrieves metric definitions for the given collection. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
$filter | string | An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. Required. |
account_name | string | Cosmos DB database account name. Required. |
collection_rid | string | Cosmos DB collection rid. Required. |
database_rid | string | Cosmos DB database rid. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
subscription_id | string | |
$filter | string | An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). Default value is None. |
SELECT examples
- list_metrics
- list_usages
Retrieves the metrics determined by the given filter for the given database account and collection.
SELECT
name,
endTime,
metricValues,
startTime,
timeGrain,
unit
FROM azure.cosmosdb.collection
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND account_name = '{{ account_name }}' -- required
AND database_rid = '{{ database_rid }}' -- required
AND collection_rid = '{{ collection_rid }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}' -- required
;
Retrieves the usages (most recent storage data) for the given collection.
SELECT
name,
currentValue,
limit,
quotaPeriod,
unit
FROM azure.cosmosdb.collection
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND account_name = '{{ account_name }}' -- required
AND database_rid = '{{ database_rid }}' -- required
AND collection_rid = '{{ collection_rid }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}'
;
Lifecycle Methods
- list_metric_definitions
Retrieves metric definitions for the given collection.
EXEC azure.cosmosdb.collection.list_metric_definitions
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@database_rid='{{ database_rid }}' --required,
@collection_rid='{{ collection_rid }}' --required,
@subscription_id='{{ subscription_id }}' --required
;