DatabaseAccountsOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

CosmosDBManagementClient's

<xref:database_accounts> attribute.

Inheritance
builtins.object
DatabaseAccountsOperations

Constructor

DatabaseAccountsOperations(*args, **kwargs)

Methods

begin_create_or_update

Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account.

begin_delete

Deletes an existing Azure Cosmos DB database account.

begin_failover_priority_change

Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.

begin_offline_region

Offline the specified region for the specified Azure Cosmos DB database account.

begin_online_region

Online the specified region for the specified Azure Cosmos DB database account.

begin_regenerate_key

Regenerates an access key for the specified Azure Cosmos DB database account.

begin_update

Updates the properties of an existing Azure Cosmos DB database account.

check_name_exists

Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters.

get

Retrieves the properties of an existing Azure Cosmos DB database account.

get_read_only_keys

Lists the read-only access keys for the specified Azure Cosmos DB database account.

list

Lists all the Azure Cosmos DB database accounts available under the subscription.

list_by_resource_group

Lists all the Azure Cosmos DB database accounts available under the given resource group.

list_connection_strings

Lists the connection strings for the specified Azure Cosmos DB database account.

list_keys

Lists the access keys for the specified Azure Cosmos DB database account.

list_metric_definitions

Retrieves metric definitions for the given database account.

list_metrics

Retrieves the metrics determined by the given filter for the given database account.

list_read_only_keys

Lists the read-only access keys for the specified Azure Cosmos DB database account.

list_usages

Retrieves the usages (most recent data) for the given database account.

begin_create_or_update

Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account.

async begin_create_or_update(resource_group_name: str, account_name: str, create_update_parameters: _models.DatabaseAccountCreateUpdateParameters, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[_models.DatabaseAccountGetResults]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

create_update_parameters
Required

The parameters to provide for the current database account. Is either a DatabaseAccountCreateUpdateParameters type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either DatabaseAccountGetResults or the result of cls(response)

Exceptions

Type Description

begin_delete

Deletes an existing Azure Cosmos DB database account.

async begin_delete(resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_failover_priority_change

Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.

async begin_failover_priority_change(resource_group_name: str, account_name: str, failover_parameters: _models.FailoverPolicies, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

failover_parameters
Required

The new failover policies for the database account. Is either a FailoverPolicies type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_offline_region

Offline the specified region for the specified Azure Cosmos DB database account.

async begin_offline_region(resource_group_name: str, account_name: str, region_parameter_for_offline: _models.RegionForOnlineOffline, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

region_parameter_for_offline
Required

Cosmos DB region to offline for the database account. Is either a RegionForOnlineOffline type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_online_region

Online the specified region for the specified Azure Cosmos DB database account.

async begin_online_region(resource_group_name: str, account_name: str, region_parameter_for_online: _models.RegionForOnlineOffline, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

region_parameter_for_online
Required

Cosmos DB region to online for the database account. Is either a RegionForOnlineOffline type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_regenerate_key

Regenerates an access key for the specified Azure Cosmos DB database account.

async begin_regenerate_key(resource_group_name: str, account_name: str, key_to_regenerate: _models.DatabaseAccountRegenerateKeyParameters, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

key_to_regenerate
Required

The name of the key to regenerate. Is either a DatabaseAccountRegenerateKeyParameters type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_update

Updates the properties of an existing Azure Cosmos DB database account.

async begin_update(resource_group_name: str, account_name: str, update_parameters: _models.DatabaseAccountUpdateParameters, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[_models.DatabaseAccountGetResults]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

update_parameters
Required

The parameters to provide for the current database account. Is either a DatabaseAccountUpdateParameters type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either DatabaseAccountGetResults or the result of cls(response)

Exceptions

Type Description

check_name_exists

Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters.

async check_name_exists(account_name: str, **kwargs: Any) -> bool

Parameters

Name Description
account_name
Required
str

Cosmos DB database account name. Required.

Returns

Type Description

bool or the result of cls(response)

Exceptions

Type Description

get

Retrieves the properties of an existing Azure Cosmos DB database account.

async get(resource_group_name: str, account_name: str, **kwargs: Any) -> DatabaseAccountGetResults

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

Returns

Type Description

DatabaseAccountGetResults or the result of cls(response)

Exceptions

Type Description

get_read_only_keys

Lists the read-only access keys for the specified Azure Cosmos DB database account.

async get_read_only_keys(resource_group_name: str, account_name: str, **kwargs: Any) -> DatabaseAccountListReadOnlyKeysResult

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

Returns

Type Description

DatabaseAccountListReadOnlyKeysResult or the result of cls(response)

Exceptions

Type Description

list

Lists all the Azure Cosmos DB database accounts available under the subscription.

list(**kwargs: Any) -> AsyncIterable[DatabaseAccountGetResults]

Returns

Type Description

An iterator like instance of either DatabaseAccountGetResults or the result of cls(response)

Exceptions

Type Description

list_by_resource_group

Lists all the Azure Cosmos DB database accounts available under the given resource group.

list_by_resource_group(resource_group_name: str, **kwargs: Any) -> AsyncIterable[DatabaseAccountGetResults]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

Returns

Type Description

An iterator like instance of either DatabaseAccountGetResults or the result of cls(response)

Exceptions

Type Description

list_connection_strings

Lists the connection strings for the specified Azure Cosmos DB database account.

async list_connection_strings(resource_group_name: str, account_name: str, **kwargs: Any) -> DatabaseAccountListConnectionStringsResult

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

Returns

Type Description

DatabaseAccountListConnectionStringsResult or the result of cls(response)

Exceptions

Type Description

list_keys

Lists the access keys for the specified Azure Cosmos DB database account.

async list_keys(resource_group_name: str, account_name: str, **kwargs: Any) -> DatabaseAccountListKeysResult

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

Returns

Type Description

DatabaseAccountListKeysResult or the result of cls(response)

Exceptions

Type Description

list_metric_definitions

Retrieves metric definitions for the given database account.

list_metric_definitions(resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterable[MetricDefinition]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

Returns

Type Description

An iterator like instance of either MetricDefinition or the result of cls(response)

Exceptions

Type Description

list_metrics

Retrieves the metrics determined by the given filter for the given database account.

list_metrics(resource_group_name: str, account_name: str, filter: str, **kwargs: Any) -> AsyncIterable[Metric]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

filter
Required
str

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.

Returns

Type Description

An iterator like instance of either Metric or the result of cls(response)

Exceptions

Type Description

list_read_only_keys

Lists the read-only access keys for the specified Azure Cosmos DB database account.

async list_read_only_keys(resource_group_name: str, account_name: str, **kwargs: Any) -> DatabaseAccountListReadOnlyKeysResult

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

Returns

Type Description

DatabaseAccountListReadOnlyKeysResult or the result of cls(response)

Exceptions

Type Description

list_usages

Retrieves the usages (most recent data) for the given database account.

list_usages(resource_group_name: str, account_name: str, filter: str | None = None, **kwargs: Any) -> AsyncIterable[Usage]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

account_name
Required
str

Cosmos DB database account name. Required.

filter
Required
str

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.

Returns

Type Description

An iterator like instance of either Usage or the result of cls(response)

Exceptions

Type Description

Attributes

models

models = <module 'azure.mgmt.cosmosdb.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\mgmt\\cosmosdb\\models\\__init__.py'>