diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/__init__.py new file mode 100644 index 000000000000..9edd8273e121 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import CosmosDBConfiguration +from ._cosmos_db import CosmosDB +__all__ = ['CosmosDB', 'CosmosDBConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/_configuration.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/_configuration.py new file mode 100644 index 000000000000..f1a57c614ec1 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/_configuration.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class CosmosDBConfiguration(AzureConfiguration): + """Configuration for CosmosDB + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(CosmosDBConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-cosmosdb/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/_cosmos_db.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/_cosmos_db.py new file mode 100644 index 000000000000..30a2254653de --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/_cosmos_db.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import CosmosDBConfiguration +from .operations import DatabaseAccountsOperations +from .operations import Operations +from .operations import DatabaseOperations +from .operations import CollectionOperations +from .operations import CollectionRegionOperations +from .operations import DatabaseAccountRegionOperations +from .operations import PercentileSourceTargetOperations +from .operations import PercentileTargetOperations +from .operations import PercentileOperations +from .operations import CollectionPartitionRegionOperations +from .operations import CollectionPartitionOperations +from .operations import PartitionKeyRangeIdOperations +from .operations import PartitionKeyRangeIdRegionOperations +from . import models + + +class CosmosDB(SDKClient): + """Azure Cosmos DB Database Service Resource Provider REST API + + :ivar config: Configuration for client. + :vartype config: CosmosDBConfiguration + + :ivar database_accounts: DatabaseAccounts operations + :vartype database_accounts: azure.mgmt.cosmosdb.v2015_04_01.operations.DatabaseAccountsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.cosmosdb.v2015_04_01.operations.Operations + :ivar database: Database operations + :vartype database: azure.mgmt.cosmosdb.v2015_04_01.operations.DatabaseOperations + :ivar collection: Collection operations + :vartype collection: azure.mgmt.cosmosdb.v2015_04_01.operations.CollectionOperations + :ivar collection_region: CollectionRegion operations + :vartype collection_region: azure.mgmt.cosmosdb.v2015_04_01.operations.CollectionRegionOperations + :ivar database_account_region: DatabaseAccountRegion operations + :vartype database_account_region: azure.mgmt.cosmosdb.v2015_04_01.operations.DatabaseAccountRegionOperations + :ivar percentile_source_target: PercentileSourceTarget operations + :vartype percentile_source_target: azure.mgmt.cosmosdb.v2015_04_01.operations.PercentileSourceTargetOperations + :ivar percentile_target: PercentileTarget operations + :vartype percentile_target: azure.mgmt.cosmosdb.v2015_04_01.operations.PercentileTargetOperations + :ivar percentile: Percentile operations + :vartype percentile: azure.mgmt.cosmosdb.v2015_04_01.operations.PercentileOperations + :ivar collection_partition_region: CollectionPartitionRegion operations + :vartype collection_partition_region: azure.mgmt.cosmosdb.v2015_04_01.operations.CollectionPartitionRegionOperations + :ivar collection_partition: CollectionPartition operations + :vartype collection_partition: azure.mgmt.cosmosdb.v2015_04_01.operations.CollectionPartitionOperations + :ivar partition_key_range_id: PartitionKeyRangeId operations + :vartype partition_key_range_id: azure.mgmt.cosmosdb.v2015_04_01.operations.PartitionKeyRangeIdOperations + :ivar partition_key_range_id_region: PartitionKeyRangeIdRegion operations + :vartype partition_key_range_id_region: azure.mgmt.cosmosdb.v2015_04_01.operations.PartitionKeyRangeIdRegionOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = CosmosDBConfiguration(credentials, subscription_id, base_url) + super(CosmosDB, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2015-04-08' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.database_accounts = DatabaseAccountsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.database = DatabaseOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection = CollectionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection_region = CollectionRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.database_account_region = DatabaseAccountRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.percentile_source_target = PercentileSourceTargetOperations( + self._client, self.config, self._serialize, self._deserialize) + self.percentile_target = PercentileTargetOperations( + self._client, self.config, self._serialize, self._deserialize) + self.percentile = PercentileOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection_partition_region = CollectionPartitionRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection_partition = CollectionPartitionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.partition_key_range_id = PartitionKeyRangeIdOperations( + self._client, self.config, self._serialize, self._deserialize) + self.partition_key_range_id_region = PartitionKeyRangeIdRegionOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/__init__.py new file mode 100644 index 000000000000..a7f22fd3cc55 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/__init__.py @@ -0,0 +1,301 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Capability + from ._models_py3 import CassandraKeyspace + from ._models_py3 import CassandraKeyspaceCreateUpdateParameters + from ._models_py3 import CassandraKeyspaceResource + from ._models_py3 import CassandraPartitionKey + from ._models_py3 import CassandraSchema + from ._models_py3 import CassandraTable + from ._models_py3 import CassandraTableCreateUpdateParameters + from ._models_py3 import CassandraTableResource + from ._models_py3 import ClusterKey + from ._models_py3 import Column + from ._models_py3 import ConflictResolutionPolicy + from ._models_py3 import ConsistencyPolicy + from ._models_py3 import ContainerPartitionKey + from ._models_py3 import DatabaseAccount + from ._models_py3 import DatabaseAccountConnectionString + from ._models_py3 import DatabaseAccountCreateUpdateParameters + from ._models_py3 import DatabaseAccountListConnectionStringsResult + from ._models_py3 import DatabaseAccountListKeysResult + from ._models_py3 import DatabaseAccountListReadOnlyKeysResult + from ._models_py3 import DatabaseAccountPatchParameters + from ._models_py3 import DatabaseAccountRegenerateKeyParameters + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ExcludedPath + from ._models_py3 import ExtendedResourceProperties + from ._models_py3 import FailoverPolicies + from ._models_py3 import FailoverPolicy + from ._models_py3 import GremlinDatabase + from ._models_py3 import GremlinDatabaseCreateUpdateParameters + from ._models_py3 import GremlinDatabaseResource + from ._models_py3 import GremlinGraph + from ._models_py3 import GremlinGraphCreateUpdateParameters + from ._models_py3 import GremlinGraphResource + from ._models_py3 import IncludedPath + from ._models_py3 import Indexes + from ._models_py3 import IndexingPolicy + from ._models_py3 import Location + from ._models_py3 import Metric + from ._models_py3 import MetricAvailability + from ._models_py3 import MetricDefinition + from ._models_py3 import MetricName + from ._models_py3 import MetricValue + from ._models_py3 import MongoDBCollection + from ._models_py3 import MongoDBCollectionCreateUpdateParameters + from ._models_py3 import MongoDBCollectionResource + from ._models_py3 import MongoDBDatabase + from ._models_py3 import MongoDBDatabaseCreateUpdateParameters + from ._models_py3 import MongoDBDatabaseResource + from ._models_py3 import MongoIndex + from ._models_py3 import MongoIndexKeys + from ._models_py3 import MongoIndexOptions + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import PartitionMetric + from ._models_py3 import PartitionUsage + from ._models_py3 import PercentileMetric + from ._models_py3 import PercentileMetricValue + from ._models_py3 import RegionForOnlineOffline + from ._models_py3 import Resource + from ._models_py3 import SqlContainer + from ._models_py3 import SqlContainerCreateUpdateParameters + from ._models_py3 import SqlContainerResource + from ._models_py3 import SqlDatabase + from ._models_py3 import SqlDatabaseCreateUpdateParameters + from ._models_py3 import SqlDatabaseResource + from ._models_py3 import Table + from ._models_py3 import TableCreateUpdateParameters + from ._models_py3 import TableResource + from ._models_py3 import Throughput + from ._models_py3 import ThroughputResource + from ._models_py3 import ThroughputUpdateParameters + from ._models_py3 import UniqueKey + from ._models_py3 import UniqueKeyPolicy + from ._models_py3 import Usage + from ._models_py3 import VirtualNetworkRule +except (SyntaxError, ImportError): + from ._models import Capability + from ._models import CassandraKeyspace + from ._models import CassandraKeyspaceCreateUpdateParameters + from ._models import CassandraKeyspaceResource + from ._models import CassandraPartitionKey + from ._models import CassandraSchema + from ._models import CassandraTable + from ._models import CassandraTableCreateUpdateParameters + from ._models import CassandraTableResource + from ._models import ClusterKey + from ._models import Column + from ._models import ConflictResolutionPolicy + from ._models import ConsistencyPolicy + from ._models import ContainerPartitionKey + from ._models import DatabaseAccount + from ._models import DatabaseAccountConnectionString + from ._models import DatabaseAccountCreateUpdateParameters + from ._models import DatabaseAccountListConnectionStringsResult + from ._models import DatabaseAccountListKeysResult + from ._models import DatabaseAccountListReadOnlyKeysResult + from ._models import DatabaseAccountPatchParameters + from ._models import DatabaseAccountRegenerateKeyParameters + from ._models import ErrorResponse, ErrorResponseException + from ._models import ExcludedPath + from ._models import ExtendedResourceProperties + from ._models import FailoverPolicies + from ._models import FailoverPolicy + from ._models import GremlinDatabase + from ._models import GremlinDatabaseCreateUpdateParameters + from ._models import GremlinDatabaseResource + from ._models import GremlinGraph + from ._models import GremlinGraphCreateUpdateParameters + from ._models import GremlinGraphResource + from ._models import IncludedPath + from ._models import Indexes + from ._models import IndexingPolicy + from ._models import Location + from ._models import Metric + from ._models import MetricAvailability + from ._models import MetricDefinition + from ._models import MetricName + from ._models import MetricValue + from ._models import MongoDBCollection + from ._models import MongoDBCollectionCreateUpdateParameters + from ._models import MongoDBCollectionResource + from ._models import MongoDBDatabase + from ._models import MongoDBDatabaseCreateUpdateParameters + from ._models import MongoDBDatabaseResource + from ._models import MongoIndex + from ._models import MongoIndexKeys + from ._models import MongoIndexOptions + from ._models import Operation + from ._models import OperationDisplay + from ._models import PartitionMetric + from ._models import PartitionUsage + from ._models import PercentileMetric + from ._models import PercentileMetricValue + from ._models import RegionForOnlineOffline + from ._models import Resource + from ._models import SqlContainer + from ._models import SqlContainerCreateUpdateParameters + from ._models import SqlContainerResource + from ._models import SqlDatabase + from ._models import SqlDatabaseCreateUpdateParameters + from ._models import SqlDatabaseResource + from ._models import Table + from ._models import TableCreateUpdateParameters + from ._models import TableResource + from ._models import Throughput + from ._models import ThroughputResource + from ._models import ThroughputUpdateParameters + from ._models import UniqueKey + from ._models import UniqueKeyPolicy + from ._models import Usage + from ._models import VirtualNetworkRule +from ._paged_models import CassandraKeyspacePaged +from ._paged_models import CassandraTablePaged +from ._paged_models import DatabaseAccountPaged +from ._paged_models import GremlinDatabasePaged +from ._paged_models import GremlinGraphPaged +from ._paged_models import MetricDefinitionPaged +from ._paged_models import MetricPaged +from ._paged_models import MongoDBCollectionPaged +from ._paged_models import MongoDBDatabasePaged +from ._paged_models import OperationPaged +from ._paged_models import PartitionMetricPaged +from ._paged_models import PartitionUsagePaged +from ._paged_models import PercentileMetricPaged +from ._paged_models import SqlContainerPaged +from ._paged_models import SqlDatabasePaged +from ._paged_models import TablePaged +from ._paged_models import UsagePaged +from ._cosmos_db_enums import ( + DatabaseAccountKind, + DatabaseAccountOfferType, + DefaultConsistencyLevel, + ConnectorOffer, + IndexingMode, + DataType, + IndexKind, + PartitionKind, + ConflictResolutionMode, + KeyKind, + UnitType, + PrimaryAggregationType, +) + +__all__ = [ + 'Capability', + 'CassandraKeyspace', + 'CassandraKeyspaceCreateUpdateParameters', + 'CassandraKeyspaceResource', + 'CassandraPartitionKey', + 'CassandraSchema', + 'CassandraTable', + 'CassandraTableCreateUpdateParameters', + 'CassandraTableResource', + 'ClusterKey', + 'Column', + 'ConflictResolutionPolicy', + 'ConsistencyPolicy', + 'ContainerPartitionKey', + 'DatabaseAccount', + 'DatabaseAccountConnectionString', + 'DatabaseAccountCreateUpdateParameters', + 'DatabaseAccountListConnectionStringsResult', + 'DatabaseAccountListKeysResult', + 'DatabaseAccountListReadOnlyKeysResult', + 'DatabaseAccountPatchParameters', + 'DatabaseAccountRegenerateKeyParameters', + 'ErrorResponse', 'ErrorResponseException', + 'ExcludedPath', + 'ExtendedResourceProperties', + 'FailoverPolicies', + 'FailoverPolicy', + 'GremlinDatabase', + 'GremlinDatabaseCreateUpdateParameters', + 'GremlinDatabaseResource', + 'GremlinGraph', + 'GremlinGraphCreateUpdateParameters', + 'GremlinGraphResource', + 'IncludedPath', + 'Indexes', + 'IndexingPolicy', + 'Location', + 'Metric', + 'MetricAvailability', + 'MetricDefinition', + 'MetricName', + 'MetricValue', + 'MongoDBCollection', + 'MongoDBCollectionCreateUpdateParameters', + 'MongoDBCollectionResource', + 'MongoDBDatabase', + 'MongoDBDatabaseCreateUpdateParameters', + 'MongoDBDatabaseResource', + 'MongoIndex', + 'MongoIndexKeys', + 'MongoIndexOptions', + 'Operation', + 'OperationDisplay', + 'PartitionMetric', + 'PartitionUsage', + 'PercentileMetric', + 'PercentileMetricValue', + 'RegionForOnlineOffline', + 'Resource', + 'SqlContainer', + 'SqlContainerCreateUpdateParameters', + 'SqlContainerResource', + 'SqlDatabase', + 'SqlDatabaseCreateUpdateParameters', + 'SqlDatabaseResource', + 'Table', + 'TableCreateUpdateParameters', + 'TableResource', + 'Throughput', + 'ThroughputResource', + 'ThroughputUpdateParameters', + 'UniqueKey', + 'UniqueKeyPolicy', + 'Usage', + 'VirtualNetworkRule', + 'DatabaseAccountPaged', + 'MetricPaged', + 'UsagePaged', + 'MetricDefinitionPaged', + 'SqlDatabasePaged', + 'SqlContainerPaged', + 'MongoDBDatabasePaged', + 'MongoDBCollectionPaged', + 'TablePaged', + 'CassandraKeyspacePaged', + 'CassandraTablePaged', + 'GremlinDatabasePaged', + 'GremlinGraphPaged', + 'OperationPaged', + 'PercentileMetricPaged', + 'PartitionMetricPaged', + 'PartitionUsagePaged', + 'DatabaseAccountKind', + 'DatabaseAccountOfferType', + 'DefaultConsistencyLevel', + 'ConnectorOffer', + 'IndexingMode', + 'DataType', + 'IndexKind', + 'PartitionKind', + 'ConflictResolutionMode', + 'KeyKind', + 'UnitType', + 'PrimaryAggregationType', +] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_cosmos_db_enums.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_cosmos_db_enums.py new file mode 100644 index 000000000000..ba1cf399ae1f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_cosmos_db_enums.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class DatabaseAccountKind(str, Enum): + + global_document_db = "GlobalDocumentDB" + mongo_db = "MongoDB" + parse = "Parse" + + +class DatabaseAccountOfferType(str, Enum): + + standard = "Standard" + + +class DefaultConsistencyLevel(str, Enum): + + eventual = "Eventual" + session = "Session" + bounded_staleness = "BoundedStaleness" + strong = "Strong" + consistent_prefix = "ConsistentPrefix" + + +class ConnectorOffer(str, Enum): + + small = "Small" + + +class IndexingMode(str, Enum): + + consistent = "Consistent" + lazy = "Lazy" + none = "None" + + +class DataType(str, Enum): + + string = "String" + number = "Number" + point = "Point" + polygon = "Polygon" + line_string = "LineString" + multi_polygon = "MultiPolygon" + + +class IndexKind(str, Enum): + + hash = "Hash" + range = "Range" + spatial = "Spatial" + + +class PartitionKind(str, Enum): + + hash = "Hash" + range = "Range" + + +class ConflictResolutionMode(str, Enum): + + last_writer_wins = "LastWriterWins" + custom = "Custom" + + +class KeyKind(str, Enum): + + primary = "primary" + secondary = "secondary" + primary_readonly = "primaryReadonly" + secondary_readonly = "secondaryReadonly" + + +class UnitType(str, Enum): + + count = "Count" + bytes = "Bytes" + seconds = "Seconds" + percent = "Percent" + count_per_second = "CountPerSecond" + bytes_per_second = "BytesPerSecond" + milliseconds = "Milliseconds" + + +class PrimaryAggregationType(str, Enum): + + none = "None" + average = "Average" + total = "Total" + minimum = "Minimum" + maximum = "Maximum" + last = "Last" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_models.py new file mode 100644 index 000000000000..47653ada34a7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_models.py @@ -0,0 +1,2772 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Capability(Model): + """Cosmos DB capability object. + + :param name: Name of the Cosmos DB capability. For example, "name": + "EnableCassandra". Current values also include "EnableTable" and + "EnableGremlin". + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Capability, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class Resource(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class CassandraKeyspace(Resource): + """An Azure Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_keyspace_id: Required. Name of the Cosmos DB Cassandra + keyspace + :type cassandra_keyspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_keyspace_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_keyspace_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspace, self).__init__(**kwargs) + self.cassandra_keyspace_id = kwargs.get('cassandra_keyspace_id', None) + + +class CassandraKeyspaceCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Cassandra keyspace. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Cassandra + keyspace + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraKeyspaceResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class CassandraKeyspaceResource(Model): + """Cosmos DB Cassandra keyspace id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra keyspace + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class CassandraPartitionKey(Model): + """Cosmos DB Cassandra table partition key. + + :param name: Name of the Cosmos DB Cassandra table partition key + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraPartitionKey, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class CassandraSchema(Model): + """Cosmos DB Cassandra table schema. + + :param columns: List of Cassandra table columns. + :type columns: list[~azure.mgmt.cosmosdb.v2015_04_01.models.Column] + :param partition_keys: List of partition key. + :type partition_keys: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraPartitionKey] + :param cluster_keys: List of cluster key. + :type cluster_keys: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.ClusterKey] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'partition_keys': {'key': 'partitionKeys', 'type': '[CassandraPartitionKey]'}, + 'cluster_keys': {'key': 'clusterKeys', 'type': '[ClusterKey]'}, + } + + def __init__(self, **kwargs): + super(CassandraSchema, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + self.partition_keys = kwargs.get('partition_keys', None) + self.cluster_keys = kwargs.get('cluster_keys', None) + + +class CassandraTable(Resource): + """An Azure Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_table_id: Required. Name of the Cosmos DB Cassandra table + :type cassandra_table_id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraSchema + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_table_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_table_id': {'key': 'properties.id', 'type': 'str'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'schema': {'key': 'properties.schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, **kwargs): + super(CassandraTable, self).__init__(**kwargs) + self.cassandra_table_id = kwargs.get('cassandra_table_id', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.schema = kwargs.get('schema', None) + + +class CassandraTableCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Cassandra table. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraTableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class CassandraTableResource(Model): + """Cosmos DB Cassandra table id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra table + :type id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraSchema + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, **kwargs): + super(CassandraTableResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.schema = kwargs.get('schema', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ClusterKey(Model): + """Cosmos DB Cassandra table cluster key. + + :param name: Name of the Cosmos DB Cassandra table cluster key + :type name: str + :param order_by: Order of the Cosmos DB Cassandra table cluster key, only + support "Asc" and "Desc" + :type order_by: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'order_by': {'key': 'orderBy', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ClusterKey, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.order_by = kwargs.get('order_by', None) + + +class Column(Model): + """Cosmos DB Cassandra table column. + + :param name: Name of the Cosmos DB Cassandra table column + :type name: str + :param type: Type of the Cosmos DB Cassandra table column + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Column, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class ConflictResolutionPolicy(Model): + """The conflict resolution policy for the container. + + :param mode: Indicates the conflict resolution mode. Possible values + include: 'LastWriterWins', 'Custom'. Default value: "LastWriterWins" . + :type mode: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionMode + :param conflict_resolution_path: The conflict resolution path in the case + of LastWriterWins mode. + :type conflict_resolution_path: str + :param conflict_resolution_procedure: The procedure to resolve conflicts + in the case of custom mode. + :type conflict_resolution_procedure: str + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, + 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ConflictResolutionPolicy, self).__init__(**kwargs) + self.mode = kwargs.get('mode', "LastWriterWins") + self.conflict_resolution_path = kwargs.get('conflict_resolution_path', None) + self.conflict_resolution_procedure = kwargs.get('conflict_resolution_procedure', None) + + +class ConsistencyPolicy(Model): + """The consistency policy for the Cosmos DB database account. + + All required parameters must be populated in order to send to Azure. + + :param default_consistency_level: Required. The default consistency level + and configuration settings of the Cosmos DB account. Possible values + include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', + 'ConsistentPrefix' + :type default_consistency_level: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.DefaultConsistencyLevel + :param max_staleness_prefix: When used with the Bounded Staleness + consistency level, this value represents the number of stale requests + tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_staleness_prefix: long + :param max_interval_in_seconds: When used with the Bounded Staleness + consistency level, this value represents the time amount of staleness (in + seconds) tolerated. Accepted range for this value is 5 - 86400. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_interval_in_seconds: int + """ + + _validation = { + 'default_consistency_level': {'required': True}, + 'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1}, + 'max_interval_in_seconds': {'maximum': 86400, 'minimum': 5}, + } + + _attribute_map = { + 'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'DefaultConsistencyLevel'}, + 'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'}, + 'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ConsistencyPolicy, self).__init__(**kwargs) + self.default_consistency_level = kwargs.get('default_consistency_level', None) + self.max_staleness_prefix = kwargs.get('max_staleness_prefix', None) + self.max_interval_in_seconds = kwargs.get('max_interval_in_seconds', None) + + +class ContainerPartitionKey(Model): + """The configuration of the partition key to be used for partitioning data + into multiple partitions. + + :param paths: List of paths using which data within the container can be + partitioned + :type paths: list[str] + :param kind: Indicates the kind of algorithm used for partitioning. + Possible values include: 'Hash', 'Range'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionKind + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ContainerPartitionKey, self).__init__(**kwargs) + self.paths = kwargs.get('paths', None) + self.kind = kwargs.get('kind', "Hash") + + +class DatabaseAccount(Resource): + """An Azure Cosmos DB database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountKind + :param provisioning_state: + :type provisioning_state: str + :ivar document_endpoint: The connection endpoint for the Cosmos DB + database account. + :vartype document_endpoint: str + :ivar database_account_offer_type: The offer type for the Cosmos DB + database account. Default value: Standard. Possible values include: + 'Standard' + :vartype database_account_offer_type: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountOfferType + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param consistency_policy: The consistency policy for the Cosmos DB + database account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConsistencyPolicy + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Capability] + :ivar write_locations: An array that contains the write location for the + Cosmos DB account. + :vartype write_locations: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Location] + :ivar read_locations: An array that contains of the read locations enabled + for the Cosmos DB account. + :vartype read_locations: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Location] + :ivar failover_policies: An array that contains the regions ordered by + their failover priorities. + :vartype failover_policies: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.FailoverPolicy] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConnectorOffer + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'database_account_offer_type': {'readonly': True}, + 'write_locations': {'readonly': True}, + 'read_locations': {'readonly': True}, + 'failover_policies': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'DatabaseAccountOfferType'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'}, + 'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'}, + 'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccount, self).__init__(**kwargs) + self.kind = kwargs.get('kind', "GlobalDocumentDB") + self.provisioning_state = kwargs.get('provisioning_state', None) + self.document_endpoint = None + self.database_account_offer_type = None + self.ip_range_filter = kwargs.get('ip_range_filter', None) + self.is_virtual_network_filter_enabled = kwargs.get('is_virtual_network_filter_enabled', None) + self.enable_automatic_failover = kwargs.get('enable_automatic_failover', None) + self.consistency_policy = kwargs.get('consistency_policy', None) + self.capabilities = kwargs.get('capabilities', None) + self.write_locations = None + self.read_locations = None + self.failover_policies = None + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.enable_multiple_write_locations = kwargs.get('enable_multiple_write_locations', None) + self.enable_cassandra_connector = kwargs.get('enable_cassandra_connector', None) + self.connector_offer = kwargs.get('connector_offer', None) + + +class DatabaseAccountConnectionString(Model): + """Connection string for the Cosmos DB account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar connection_string: Value of the connection string + :vartype connection_string: str + :ivar description: Description of the connection string + :vartype description: str + """ + + _validation = { + 'connection_string': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountConnectionString, self).__init__(**kwargs) + self.connection_string = None + self.description = None + + +class DatabaseAccountCreateUpdateParameters(Resource): + """Parameters to create and update Cosmos DB database accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountKind + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConsistencyPolicy + :param locations: Required. An array that contains the georeplication + locations enabled for the Cosmos DB account. + :type locations: list[~azure.mgmt.cosmosdb.v2015_04_01.models.Location] + :ivar database_account_offer_type: Required. The offer type for the + database. Default value: "Standard" . + :vartype database_account_offer_type: str + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConnectorOffer + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + } + + database_account_offer_type = "Standard" + + def __init__(self, **kwargs): + super(DatabaseAccountCreateUpdateParameters, self).__init__(**kwargs) + self.kind = kwargs.get('kind', "GlobalDocumentDB") + self.consistency_policy = kwargs.get('consistency_policy', None) + self.locations = kwargs.get('locations', None) + self.ip_range_filter = kwargs.get('ip_range_filter', None) + self.is_virtual_network_filter_enabled = kwargs.get('is_virtual_network_filter_enabled', None) + self.enable_automatic_failover = kwargs.get('enable_automatic_failover', None) + self.capabilities = kwargs.get('capabilities', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.enable_multiple_write_locations = kwargs.get('enable_multiple_write_locations', None) + self.enable_cassandra_connector = kwargs.get('enable_cassandra_connector', None) + self.connector_offer = kwargs.get('connector_offer', None) + + +class DatabaseAccountListConnectionStringsResult(Model): + """The connection strings for the given database account. + + :param connection_strings: An array that contains the connection strings + for the Cosmos DB account. + :type connection_strings: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountConnectionString] + """ + + _attribute_map = { + 'connection_strings': {'key': 'connectionStrings', 'type': '[DatabaseAccountConnectionString]'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountListConnectionStringsResult, self).__init__(**kwargs) + self.connection_strings = kwargs.get('connection_strings', None) + + +class DatabaseAccountListReadOnlyKeysResult(Model): + """The read-only access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountListReadOnlyKeysResult, self).__init__(**kwargs) + self.primary_readonly_master_key = None + self.secondary_readonly_master_key = None + + +class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): + """The access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + :ivar primary_master_key: Base 64 encoded value of the primary read-write + key. + :vartype primary_master_key: str + :ivar secondary_master_key: Base 64 encoded value of the secondary + read-write key. + :vartype secondary_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + 'primary_master_key': {'readonly': True}, + 'secondary_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + 'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'}, + 'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountListKeysResult, self).__init__(**kwargs) + self.primary_master_key = None + self.secondary_master_key = None + + +class DatabaseAccountPatchParameters(Model): + """Parameters for patching Azure Cosmos DB database account properties. + + :param tags: + :type tags: dict[str, str] + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Capability] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountPatchParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.capabilities = kwargs.get('capabilities', None) + + +class DatabaseAccountRegenerateKeyParameters(Model): + """Parameters to regenerate the keys within the database account. + + All required parameters must be populated in order to send to Azure. + + :param key_kind: Required. The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + :type key_kind: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.KeyKind + """ + + _validation = { + 'key_kind': {'required': True}, + } + + _attribute_map = { + 'key_kind': {'key': 'keyKind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountRegenerateKeyParameters, self).__init__(**kwargs) + self.key_kind = kwargs.get('key_kind', None) + + +class ErrorResponse(Model): + """Error Response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ExcludedPath(Model): + """ExcludedPath. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExcludedPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + + +class ExtendedResourceProperties(Model): + """The system generated resource properties associated with SQL databases and + SQL containers. + + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _attribute_map = { + '_rid': {'key': '_rid', 'type': 'str'}, + '_ts': {'key': '_ts', 'type': 'object'}, + '_etag': {'key': '_etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExtendedResourceProperties, self).__init__(**kwargs) + self._rid = kwargs.get('_rid', None) + self._ts = kwargs.get('_ts', None) + self._etag = kwargs.get('_etag', None) + + +class FailoverPolicies(Model): + """The list of new failover policies for the failover priority change. + + All required parameters must be populated in order to send to Azure. + + :param failover_policies: Required. List of failover policies. + :type failover_policies: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.FailoverPolicy] + """ + + _validation = { + 'failover_policies': {'required': True}, + } + + _attribute_map = { + 'failover_policies': {'key': 'failoverPolicies', 'type': '[FailoverPolicy]'}, + } + + def __init__(self, **kwargs): + super(FailoverPolicies, self).__init__(**kwargs) + self.failover_policies = kwargs.get('failover_policies', None) + + +class FailoverPolicy(Model): + """The failover policy for a given region of a database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region in which the database + account replicates to. Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region in which the database account + exists. + :type location_name: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + """ + + _validation = { + 'id': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(FailoverPolicy, self).__init__(**kwargs) + self.id = None + self.location_name = kwargs.get('location_name', None) + self.failover_priority = kwargs.get('failover_priority', None) + + +class GremlinDatabase(Resource): + """An Azure Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_database_id: Required. Name of the Cosmos DB Gremlin + database + :type gremlin_database_id: str + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_database_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_database_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabase, self).__init__(**kwargs) + self.gremlin_database_id = kwargs.get('gremlin_database_id', None) + self._rid = kwargs.get('_rid', None) + self._ts = kwargs.get('_ts', None) + self._etag = kwargs.get('_etag', None) + + +class GremlinDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Gremlin database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class GremlinDatabaseResource(Model): + """Cosmos DB Gremlin database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class GremlinGraph(Resource): + """An Azure Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_graph_id: Required. Name of the Cosmos DB Gremlin graph + :type gremlin_graph_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionPolicy + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_graph_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_graph_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinGraph, self).__init__(**kwargs) + self.gremlin_graph_id = kwargs.get('gremlin_graph_id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + self._rid = kwargs.get('_rid', None) + self._ts = kwargs.get('_ts', None) + self._etag = kwargs.get('_etag', None) + + +class GremlinGraphCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Gremlin graph. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Gremlin graph + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinGraphResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(GremlinGraphCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class GremlinGraphResource(Model): + """Cosmos DB Gremlin graph resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin graph + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, **kwargs): + super(GremlinGraphResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + + +class IncludedPath(Model): + """The paths that are included in indexing. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + :param indexes: List of indexes for this path + :type indexes: list[~azure.mgmt.cosmosdb.v2015_04_01.models.Indexes] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, + } + + def __init__(self, **kwargs): + super(IncludedPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.indexes = kwargs.get('indexes', None) + + +class Indexes(Model): + """The indexes for the path. + + :param data_type: The datatype for which the indexing behavior is applied + to. Possible values include: 'String', 'Number', 'Point', 'Polygon', + 'LineString', 'MultiPolygon'. Default value: "String" . + :type data_type: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.DataType + :param precision: The precision of the index. -1 is maximum precision. + :type precision: int + :param kind: Indicates the type of index. Possible values include: 'Hash', + 'Range', 'Spatial'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexKind + """ + + _attribute_map = { + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'precision': {'key': 'precision', 'type': 'int'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Indexes, self).__init__(**kwargs) + self.data_type = kwargs.get('data_type', "String") + self.precision = kwargs.get('precision', None) + self.kind = kwargs.get('kind', "Hash") + + +class IndexingPolicy(Model): + """Cosmos DB indexing policy. + + :param automatic: Indicates if the indexing policy is automatic + :type automatic: bool + :param indexing_mode: Indicates the indexing mode. Possible values + include: 'Consistent', 'Lazy', 'None'. Default value: "Consistent" . + :type indexing_mode: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingMode + :param included_paths: List of paths to include in the indexing + :type included_paths: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.IncludedPath] + :param excluded_paths: List of paths to exclude from indexing + :type excluded_paths: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.ExcludedPath] + """ + + _attribute_map = { + 'automatic': {'key': 'automatic', 'type': 'bool'}, + 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, + 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, + } + + def __init__(self, **kwargs): + super(IndexingPolicy, self).__init__(**kwargs) + self.automatic = kwargs.get('automatic', None) + self.indexing_mode = kwargs.get('indexing_mode', "Consistent") + self.included_paths = kwargs.get('included_paths', None) + self.excluded_paths = kwargs.get('excluded_paths', None) + + +class Location(Model): + """A region in which the Azure Cosmos DB database account is deployed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region within the database account. + Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region. + :type location_name: str + :ivar document_endpoint: The connection endpoint for the specific region. + Example: + https://<accountName>-<locationName>.documents.azure.com:443/ + :vartype document_endpoint: str + :param provisioning_state: + :type provisioning_state: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + :param is_zone_redundant: Flag to indicate whether or not this region is + an AvailabilityZone region + :type is_zone_redundant: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'document_endpoint': {'key': 'documentEndpoint', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + 'is_zone_redundant': {'key': 'isZoneRedundant', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(Location, self).__init__(**kwargs) + self.id = None + self.location_name = kwargs.get('location_name', None) + self.document_endpoint = None + self.provisioning_state = kwargs.get('provisioning_state', None) + self.failover_priority = kwargs.get('failover_priority', None) + self.is_zone_redundant = kwargs.get('is_zone_redundant', None) + + +class Metric(Model): + """Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.MetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + } + + def __init__(self, **kwargs): + super(Metric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = kwargs.get('unit', None) + self.name = None + self.metric_values = None + + +class MetricAvailability(Model): + """The availability of the metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :ivar retention: The retention for the metric values. + :vartype retention: str + """ + + _validation = { + 'time_grain': {'readonly': True}, + 'retention': {'readonly': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'retention': {'key': 'retention', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = None + self.retention = None + + +class MetricDefinition(Model): + """The definition of a metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar metric_availabilities: The list of metric availabilities for the + account. + :vartype metric_availabilities: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.MetricAvailability] + :ivar primary_aggregation_type: The primary aggregation type of the + metric. Possible values include: 'None', 'Average', 'Total', 'Minimum', + 'Maximum', 'Last' + :vartype primary_aggregation_type: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.PrimaryAggregationType + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar resource_uri: The resource uri of the database. + :vartype resource_uri: str + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + """ + + _validation = { + 'metric_availabilities': {'readonly': True}, + 'primary_aggregation_type': {'readonly': True}, + 'resource_uri': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + } + + def __init__(self, **kwargs): + super(MetricDefinition, self).__init__(**kwargs) + self.metric_availabilities = None + self.primary_aggregation_type = None + self.unit = kwargs.get('unit', None) + self.resource_uri = None + self.name = None + + +class MetricName(Model): + """A metric name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The name of the metric. + :vartype value: str + :ivar localized_value: The friendly name of the metric. + :vartype localized_value: str + """ + + _validation = { + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricName, self).__init__(**kwargs) + self.value = None + self.localized_value = None + + +class MetricValue(Model): + """Represents metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(MetricValue, self).__init__(**kwargs) + self._count = None + self.average = None + self.maximum = None + self.minimum = None + self.timestamp = None + self.total = None + + +class MongoDBCollection(Resource): + """An Azure Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_collection_id: Required. Name of the Cosmos DB MongoDB + collection + :type mongo_db_collection_id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoIndex] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_collection_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_collection_id': {'key': 'properties.id', 'type': 'str'}, + 'shard_key': {'key': 'properties.shardKey', 'type': '{str}'}, + 'indexes': {'key': 'properties.indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, **kwargs): + super(MongoDBCollection, self).__init__(**kwargs) + self.mongo_db_collection_id = kwargs.get('mongo_db_collection_id', None) + self.shard_key = kwargs.get('shard_key', None) + self.indexes = kwargs.get('indexes', None) + + +class MongoDBCollectionCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB MongoDB collection. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a MongoDB + collection + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBCollectionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MongoDBCollectionCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class MongoDBCollectionResource(Model): + """Cosmos DB MongoDB collection resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB collection + :type id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoIndex] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, **kwargs): + super(MongoDBCollectionResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.shard_key = kwargs.get('shard_key', None) + self.indexes = kwargs.get('indexes', None) + + +class MongoDBDatabase(Resource): + """An Azure Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_database_id: Required. Name of the Cosmos DB MongoDB + database + :type mongo_db_database_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_database_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_database_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDBDatabase, self).__init__(**kwargs) + self.mongo_db_database_id = kwargs.get('mongo_db_database_id', None) + + +class MongoDBDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB MongoDB database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a MongoDB database + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MongoDBDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class MongoDBDatabaseResource(Model): + """Cosmos DB MongoDB database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDBDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class MongoIndex(Model): + """Cosmos DB MongoDB collection index key. + + :param key: Cosmos DB MongoDB collection index keys + :type key: ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoIndexKeys + :param options: Cosmos DB MongoDB collection index key options + :type options: ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoIndexOptions + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, + 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, + } + + def __init__(self, **kwargs): + super(MongoIndex, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.options = kwargs.get('options', None) + + +class MongoIndexKeys(Model): + """Cosmos DB MongoDB collection resource object. + + :param keys: List of keys for each MongoDB collection in the Azure Cosmos + DB service + :type keys: list[str] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MongoIndexKeys, self).__init__(**kwargs) + self.keys = kwargs.get('keys', None) + + +class MongoIndexOptions(Model): + """Cosmos DB MongoDB collection index options. + + :param expire_after_seconds: Expire after seconds + :type expire_after_seconds: int + :param unique: Is unique or not + :type unique: bool + """ + + _attribute_map = { + 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, + 'unique': {'key': 'unique', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(MongoIndexOptions, self).__init__(**kwargs) + self.expire_after_seconds = kwargs.get('expire_after_seconds', None) + self.unique = kwargs.get('unique', None) + + +class Operation(Model): + """REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.cosmosdb.v2015_04_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ResourceProvider + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'Provider', 'type': 'str'}, + 'resource': {'key': 'Resource', 'type': 'str'}, + 'operation': {'key': 'Operation', 'type': 'str'}, + 'description': {'key': 'Description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class PartitionMetric(Metric): + """The metric values for a single partition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.MetricValue] + :ivar partition_id: The partition id (GUID identifier) of the metric + values. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the metric values. + :vartype partition_key_range_id: str + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PartitionMetric, self).__init__(**kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class Usage(Model): + """The usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(Usage, self).__init__(**kwargs) + self.unit = kwargs.get('unit', None) + self.name = None + self.quota_period = None + self.limit = None + self.current_value = None + + +class PartitionUsage(Usage): + """The partition level usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + :ivar partition_id: The partition id (GUID identifier) of the usages. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the usages. + :vartype partition_key_range_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PartitionUsage, self).__init__(**kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class PercentileMetric(Model): + """Percentile Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar metric_values: The percentile metric values for the specified time + window and timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.PercentileMetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[PercentileMetricValue]'}, + } + + def __init__(self, **kwargs): + super(PercentileMetric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = kwargs.get('unit', None) + self.name = None + self.metric_values = None + + +class PercentileMetricValue(MetricValue): + """Represents percentile metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + :ivar p10: The 10th percentile value for the metric. + :vartype p10: float + :ivar p25: The 25th percentile value for the metric. + :vartype p25: float + :ivar p50: The 50th percentile value for the metric. + :vartype p50: float + :ivar p75: The 75th percentile value for the metric. + :vartype p75: float + :ivar p90: The 90th percentile value for the metric. + :vartype p90: float + :ivar p95: The 95th percentile value for the metric. + :vartype p95: float + :ivar p99: The 99th percentile value for the metric. + :vartype p99: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + 'p10': {'readonly': True}, + 'p25': {'readonly': True}, + 'p50': {'readonly': True}, + 'p75': {'readonly': True}, + 'p90': {'readonly': True}, + 'p95': {'readonly': True}, + 'p99': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + 'p10': {'key': 'P10', 'type': 'float'}, + 'p25': {'key': 'P25', 'type': 'float'}, + 'p50': {'key': 'P50', 'type': 'float'}, + 'p75': {'key': 'P75', 'type': 'float'}, + 'p90': {'key': 'P90', 'type': 'float'}, + 'p95': {'key': 'P95', 'type': 'float'}, + 'p99': {'key': 'P99', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(PercentileMetricValue, self).__init__(**kwargs) + self.p10 = None + self.p25 = None + self.p50 = None + self.p75 = None + self.p90 = None + self.p95 = None + self.p99 = None + + +class RegionForOnlineOffline(Model): + """Cosmos DB region to online or offline. + + All required parameters must be populated in order to send to Azure. + + :param region: Required. Cosmos DB region, with spaces between words and + each word capitalized. + :type region: str + """ + + _validation = { + 'region': {'required': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegionForOnlineOffline, self).__init__(**kwargs) + self.region = kwargs.get('region', None) + + +class SqlContainer(Resource): + """An Azure Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_container_id: Required. Name of the Cosmos DB SQL container + :type sql_container_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionPolicy + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_container_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_container_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlContainer, self).__init__(**kwargs) + self.sql_container_id = kwargs.get('sql_container_id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + self._rid = kwargs.get('_rid', None) + self._ts = kwargs.get('_ts', None) + self._etag = kwargs.get('_etag', None) + + +class SqlContainerCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB container. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a container + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlContainerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'SqlContainerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlContainerCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlContainerResource(Model): + """Cosmos DB SQL container resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL container + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, **kwargs): + super(SqlContainerResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + + +class SqlDatabase(Resource): + """An Azure Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_database_id: Required. Name of the Cosmos DB SQL database + :type sql_database_id: str + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + :param _colls: A system generated property that specified the addressable + path of the collections resource. + :type _colls: str + :param _users: A system generated property that specifies the addressable + path of the users resource. + :type _users: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_database_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_database_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + '_colls': {'key': 'properties._colls', 'type': 'str'}, + '_users': {'key': 'properties._users', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlDatabase, self).__init__(**kwargs) + self.sql_database_id = kwargs.get('sql_database_id', None) + self._rid = kwargs.get('_rid', None) + self._ts = kwargs.get('_ts', None) + self._etag = kwargs.get('_etag', None) + self._colls = kwargs.get('_colls', None) + self._users = kwargs.get('_users', None) + + +class SqlDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB SQL database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a SQL database + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlDatabaseResource(Model): + """Cosmos DB SQL database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class Table(Resource): + """An Azure Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param table_id: Required. Name of the Cosmos DB table + :type table_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'table_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'table_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Table, self).__init__(**kwargs) + self.table_id = kwargs.get('table_id', None) + + +class TableCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Table. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Table + :type resource: ~azure.mgmt.cosmosdb.v2015_04_01.models.TableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'TableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class TableResource(Model): + """Cosmos DB table id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB table + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TableResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class Throughput(Resource): + """An Azure Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'throughput': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'throughput': {'key': 'properties.throughput', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(Throughput, self).__init__(**kwargs) + self.throughput = kwargs.get('throughput', None) + + +class ThroughputResource(Model): + """Cosmos DB resource throughput object. + + All required parameters must be populated in order to send to Azure. + + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + """ + + _validation = { + 'throughput': {'required': True}, + } + + _attribute_map = { + 'throughput': {'key': 'throughput', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ThroughputResource, self).__init__(**kwargs) + self.throughput = kwargs.get('throughput', None) + + +class ThroughputUpdateParameters(Model): + """Parameters to update Cosmos DB resource throughput. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a resource + throughput + :type resource: ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + """ + + _validation = { + 'resource': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'ThroughputResource'}, + } + + def __init__(self, **kwargs): + super(ThroughputUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + + +class UniqueKey(Model): + """The unique key on that enforces uniqueness constraint on documents in the + collection in the Azure Cosmos DB service. + + :param paths: List of paths must be unique for each document in the Azure + Cosmos DB service + :type paths: list[str] + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UniqueKey, self).__init__(**kwargs) + self.paths = kwargs.get('paths', None) + + +class UniqueKeyPolicy(Model): + """The unique key policy configuration for specifying uniqueness constraints + on documents in the collection in the Azure Cosmos DB service. + + :param unique_keys: List of unique keys on that enforces uniqueness + constraint on documents in the collection in the Azure Cosmos DB service. + :type unique_keys: list[~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKey] + """ + + _attribute_map = { + 'unique_keys': {'key': 'uniqueKeys', 'type': '[UniqueKey]'}, + } + + def __init__(self, **kwargs): + super(UniqueKeyPolicy, self).__init__(**kwargs) + self.unique_keys = kwargs.get('unique_keys', None) + + +class VirtualNetworkRule(Model): + """Virtual Network ACL Rule object. + + :param id: Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :type id: str + :param ignore_missing_vnet_service_endpoint: Create firewall rule before + the virtual network has vnet service endpoint enabled. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVNetServiceEndpoint', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_models_py3.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_models_py3.py new file mode 100644 index 000000000000..b0ee797cc523 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_models_py3.py @@ -0,0 +1,2772 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Capability(Model): + """Cosmos DB capability object. + + :param name: Name of the Cosmos DB capability. For example, "name": + "EnableCassandra". Current values also include "EnableTable" and + "EnableGremlin". + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, **kwargs) -> None: + super(Capability, self).__init__(**kwargs) + self.name = name + + +class Resource(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class CassandraKeyspace(Resource): + """An Azure Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_keyspace_id: Required. Name of the Cosmos DB Cassandra + keyspace + :type cassandra_keyspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_keyspace_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_keyspace_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, *, cassandra_keyspace_id: str, location: str=None, tags=None, **kwargs) -> None: + super(CassandraKeyspace, self).__init__(location=location, tags=tags, **kwargs) + self.cassandra_keyspace_id = cassandra_keyspace_id + + +class CassandraKeyspaceCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Cassandra keyspace. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Cassandra + keyspace + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraKeyspaceResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options + + +class CassandraKeyspaceResource(Model): + """Cosmos DB Cassandra keyspace id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra keyspace + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(CassandraKeyspaceResource, self).__init__(**kwargs) + self.id = id + + +class CassandraPartitionKey(Model): + """Cosmos DB Cassandra table partition key. + + :param name: Name of the Cosmos DB Cassandra table partition key + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, **kwargs) -> None: + super(CassandraPartitionKey, self).__init__(**kwargs) + self.name = name + + +class CassandraSchema(Model): + """Cosmos DB Cassandra table schema. + + :param columns: List of Cassandra table columns. + :type columns: list[~azure.mgmt.cosmosdb.v2015_04_01.models.Column] + :param partition_keys: List of partition key. + :type partition_keys: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraPartitionKey] + :param cluster_keys: List of cluster key. + :type cluster_keys: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.ClusterKey] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'partition_keys': {'key': 'partitionKeys', 'type': '[CassandraPartitionKey]'}, + 'cluster_keys': {'key': 'clusterKeys', 'type': '[ClusterKey]'}, + } + + def __init__(self, *, columns=None, partition_keys=None, cluster_keys=None, **kwargs) -> None: + super(CassandraSchema, self).__init__(**kwargs) + self.columns = columns + self.partition_keys = partition_keys + self.cluster_keys = cluster_keys + + +class CassandraTable(Resource): + """An Azure Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_table_id: Required. Name of the Cosmos DB Cassandra table + :type cassandra_table_id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraSchema + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_table_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_table_id': {'key': 'properties.id', 'type': 'str'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'schema': {'key': 'properties.schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, *, cassandra_table_id: str, location: str=None, tags=None, default_ttl: int=None, schema=None, **kwargs) -> None: + super(CassandraTable, self).__init__(location=location, tags=tags, **kwargs) + self.cassandra_table_id = cassandra_table_id + self.default_ttl = default_ttl + self.schema = schema + + +class CassandraTableCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Cassandra table. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraTableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options + + +class CassandraTableResource(Model): + """Cosmos DB Cassandra table id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra table + :type id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraSchema + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, *, id: str, default_ttl: int=None, schema=None, **kwargs) -> None: + super(CassandraTableResource, self).__init__(**kwargs) + self.id = id + self.default_ttl = default_ttl + self.schema = schema + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ClusterKey(Model): + """Cosmos DB Cassandra table cluster key. + + :param name: Name of the Cosmos DB Cassandra table cluster key + :type name: str + :param order_by: Order of the Cosmos DB Cassandra table cluster key, only + support "Asc" and "Desc" + :type order_by: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'order_by': {'key': 'orderBy', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, order_by: str=None, **kwargs) -> None: + super(ClusterKey, self).__init__(**kwargs) + self.name = name + self.order_by = order_by + + +class Column(Model): + """Cosmos DB Cassandra table column. + + :param name: Name of the Cosmos DB Cassandra table column + :type name: str + :param type: Type of the Cosmos DB Cassandra table column + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, **kwargs) -> None: + super(Column, self).__init__(**kwargs) + self.name = name + self.type = type + + +class ConflictResolutionPolicy(Model): + """The conflict resolution policy for the container. + + :param mode: Indicates the conflict resolution mode. Possible values + include: 'LastWriterWins', 'Custom'. Default value: "LastWriterWins" . + :type mode: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionMode + :param conflict_resolution_path: The conflict resolution path in the case + of LastWriterWins mode. + :type conflict_resolution_path: str + :param conflict_resolution_procedure: The procedure to resolve conflicts + in the case of custom mode. + :type conflict_resolution_procedure: str + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, + 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, + } + + def __init__(self, *, mode="LastWriterWins", conflict_resolution_path: str=None, conflict_resolution_procedure: str=None, **kwargs) -> None: + super(ConflictResolutionPolicy, self).__init__(**kwargs) + self.mode = mode + self.conflict_resolution_path = conflict_resolution_path + self.conflict_resolution_procedure = conflict_resolution_procedure + + +class ConsistencyPolicy(Model): + """The consistency policy for the Cosmos DB database account. + + All required parameters must be populated in order to send to Azure. + + :param default_consistency_level: Required. The default consistency level + and configuration settings of the Cosmos DB account. Possible values + include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', + 'ConsistentPrefix' + :type default_consistency_level: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.DefaultConsistencyLevel + :param max_staleness_prefix: When used with the Bounded Staleness + consistency level, this value represents the number of stale requests + tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_staleness_prefix: long + :param max_interval_in_seconds: When used with the Bounded Staleness + consistency level, this value represents the time amount of staleness (in + seconds) tolerated. Accepted range for this value is 5 - 86400. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_interval_in_seconds: int + """ + + _validation = { + 'default_consistency_level': {'required': True}, + 'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1}, + 'max_interval_in_seconds': {'maximum': 86400, 'minimum': 5}, + } + + _attribute_map = { + 'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'DefaultConsistencyLevel'}, + 'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'}, + 'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'}, + } + + def __init__(self, *, default_consistency_level, max_staleness_prefix: int=None, max_interval_in_seconds: int=None, **kwargs) -> None: + super(ConsistencyPolicy, self).__init__(**kwargs) + self.default_consistency_level = default_consistency_level + self.max_staleness_prefix = max_staleness_prefix + self.max_interval_in_seconds = max_interval_in_seconds + + +class ContainerPartitionKey(Model): + """The configuration of the partition key to be used for partitioning data + into multiple partitions. + + :param paths: List of paths using which data within the container can be + partitioned + :type paths: list[str] + :param kind: Indicates the kind of algorithm used for partitioning. + Possible values include: 'Hash', 'Range'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionKind + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, paths=None, kind="Hash", **kwargs) -> None: + super(ContainerPartitionKey, self).__init__(**kwargs) + self.paths = paths + self.kind = kind + + +class DatabaseAccount(Resource): + """An Azure Cosmos DB database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountKind + :param provisioning_state: + :type provisioning_state: str + :ivar document_endpoint: The connection endpoint for the Cosmos DB + database account. + :vartype document_endpoint: str + :ivar database_account_offer_type: The offer type for the Cosmos DB + database account. Default value: Standard. Possible values include: + 'Standard' + :vartype database_account_offer_type: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountOfferType + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param consistency_policy: The consistency policy for the Cosmos DB + database account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConsistencyPolicy + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Capability] + :ivar write_locations: An array that contains the write location for the + Cosmos DB account. + :vartype write_locations: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Location] + :ivar read_locations: An array that contains of the read locations enabled + for the Cosmos DB account. + :vartype read_locations: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Location] + :ivar failover_policies: An array that contains the regions ordered by + their failover priorities. + :vartype failover_policies: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.FailoverPolicy] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConnectorOffer + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'database_account_offer_type': {'readonly': True}, + 'write_locations': {'readonly': True}, + 'read_locations': {'readonly': True}, + 'failover_policies': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'DatabaseAccountOfferType'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'}, + 'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'}, + 'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, tags=None, kind="GlobalDocumentDB", provisioning_state: str=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, consistency_policy=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, enable_cassandra_connector: bool=None, connector_offer=None, **kwargs) -> None: + super(DatabaseAccount, self).__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.provisioning_state = provisioning_state + self.document_endpoint = None + self.database_account_offer_type = None + self.ip_range_filter = ip_range_filter + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.consistency_policy = consistency_policy + self.capabilities = capabilities + self.write_locations = None + self.read_locations = None + self.failover_policies = None + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + + +class DatabaseAccountConnectionString(Model): + """Connection string for the Cosmos DB account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar connection_string: Value of the connection string + :vartype connection_string: str + :ivar description: Description of the connection string + :vartype description: str + """ + + _validation = { + 'connection_string': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DatabaseAccountConnectionString, self).__init__(**kwargs) + self.connection_string = None + self.description = None + + +class DatabaseAccountCreateUpdateParameters(Resource): + """Parameters to create and update Cosmos DB database accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountKind + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConsistencyPolicy + :param locations: Required. An array that contains the georeplication + locations enabled for the Cosmos DB account. + :type locations: list[~azure.mgmt.cosmosdb.v2015_04_01.models.Location] + :ivar database_account_offer_type: Required. The offer type for the + database. Default value: "Standard" . + :vartype database_account_offer_type: str + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConnectorOffer + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + } + + database_account_offer_type = "Standard" + + def __init__(self, *, locations, location: str=None, tags=None, kind="GlobalDocumentDB", consistency_policy=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, enable_cassandra_connector: bool=None, connector_offer=None, **kwargs) -> None: + super(DatabaseAccountCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.consistency_policy = consistency_policy + self.locations = locations + self.ip_range_filter = ip_range_filter + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.capabilities = capabilities + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + + +class DatabaseAccountListConnectionStringsResult(Model): + """The connection strings for the given database account. + + :param connection_strings: An array that contains the connection strings + for the Cosmos DB account. + :type connection_strings: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountConnectionString] + """ + + _attribute_map = { + 'connection_strings': {'key': 'connectionStrings', 'type': '[DatabaseAccountConnectionString]'}, + } + + def __init__(self, *, connection_strings=None, **kwargs) -> None: + super(DatabaseAccountListConnectionStringsResult, self).__init__(**kwargs) + self.connection_strings = connection_strings + + +class DatabaseAccountListReadOnlyKeysResult(Model): + """The read-only access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DatabaseAccountListReadOnlyKeysResult, self).__init__(**kwargs) + self.primary_readonly_master_key = None + self.secondary_readonly_master_key = None + + +class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): + """The access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + :ivar primary_master_key: Base 64 encoded value of the primary read-write + key. + :vartype primary_master_key: str + :ivar secondary_master_key: Base 64 encoded value of the secondary + read-write key. + :vartype secondary_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + 'primary_master_key': {'readonly': True}, + 'secondary_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + 'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'}, + 'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DatabaseAccountListKeysResult, self).__init__(**kwargs) + self.primary_master_key = None + self.secondary_master_key = None + + +class DatabaseAccountPatchParameters(Model): + """Parameters for patching Azure Cosmos DB database account properties. + + :param tags: + :type tags: dict[str, str] + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Capability] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + } + + def __init__(self, *, tags=None, capabilities=None, **kwargs) -> None: + super(DatabaseAccountPatchParameters, self).__init__(**kwargs) + self.tags = tags + self.capabilities = capabilities + + +class DatabaseAccountRegenerateKeyParameters(Model): + """Parameters to regenerate the keys within the database account. + + All required parameters must be populated in order to send to Azure. + + :param key_kind: Required. The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + :type key_kind: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.KeyKind + """ + + _validation = { + 'key_kind': {'required': True}, + } + + _attribute_map = { + 'key_kind': {'key': 'keyKind', 'type': 'str'}, + } + + def __init__(self, *, key_kind, **kwargs) -> None: + super(DatabaseAccountRegenerateKeyParameters, self).__init__(**kwargs) + self.key_kind = key_kind + + +class ErrorResponse(Model): + """Error Response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ExcludedPath(Model): + """ExcludedPath. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__(self, *, path: str=None, **kwargs) -> None: + super(ExcludedPath, self).__init__(**kwargs) + self.path = path + + +class ExtendedResourceProperties(Model): + """The system generated resource properties associated with SQL databases and + SQL containers. + + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _attribute_map = { + '_rid': {'key': '_rid', 'type': 'str'}, + '_ts': {'key': '_ts', 'type': 'object'}, + '_etag': {'key': '_etag', 'type': 'str'}, + } + + def __init__(self, *, _rid: str=None, _ts=None, _etag: str=None, **kwargs) -> None: + super(ExtendedResourceProperties, self).__init__(**kwargs) + self._rid = _rid + self._ts = _ts + self._etag = _etag + + +class FailoverPolicies(Model): + """The list of new failover policies for the failover priority change. + + All required parameters must be populated in order to send to Azure. + + :param failover_policies: Required. List of failover policies. + :type failover_policies: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.FailoverPolicy] + """ + + _validation = { + 'failover_policies': {'required': True}, + } + + _attribute_map = { + 'failover_policies': {'key': 'failoverPolicies', 'type': '[FailoverPolicy]'}, + } + + def __init__(self, *, failover_policies, **kwargs) -> None: + super(FailoverPolicies, self).__init__(**kwargs) + self.failover_policies = failover_policies + + +class FailoverPolicy(Model): + """The failover policy for a given region of a database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region in which the database + account replicates to. Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region in which the database account + exists. + :type location_name: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + """ + + _validation = { + 'id': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + } + + def __init__(self, *, location_name: str=None, failover_priority: int=None, **kwargs) -> None: + super(FailoverPolicy, self).__init__(**kwargs) + self.id = None + self.location_name = location_name + self.failover_priority = failover_priority + + +class GremlinDatabase(Resource): + """An Azure Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_database_id: Required. Name of the Cosmos DB Gremlin + database + :type gremlin_database_id: str + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_database_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_database_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, gremlin_database_id: str, location: str=None, tags=None, _rid: str=None, _ts=None, _etag: str=None, **kwargs) -> None: + super(GremlinDatabase, self).__init__(location=location, tags=tags, **kwargs) + self.gremlin_database_id = gremlin_database_id + self._rid = _rid + self._ts = _ts + self._etag = _etag + + +class GremlinDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Gremlin database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options + + +class GremlinDatabaseResource(Model): + """Cosmos DB Gremlin database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(GremlinDatabaseResource, self).__init__(**kwargs) + self.id = id + + +class GremlinGraph(Resource): + """An Azure Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_graph_id: Required. Name of the Cosmos DB Gremlin graph + :type gremlin_graph_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionPolicy + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_graph_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_graph_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, gremlin_graph_id: str, location: str=None, tags=None, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, _rid: str=None, _ts=None, _etag: str=None, **kwargs) -> None: + super(GremlinGraph, self).__init__(location=location, tags=tags, **kwargs) + self.gremlin_graph_id = gremlin_graph_id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + self._rid = _rid + self._ts = _ts + self._etag = _etag + + +class GremlinGraphCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Gremlin graph. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Gremlin graph + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinGraphResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(GremlinGraphCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options + + +class GremlinGraphResource(Model): + """Cosmos DB Gremlin graph resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin graph + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, *, id: str, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(GremlinGraphResource, self).__init__(**kwargs) + self.id = id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + + +class IncludedPath(Model): + """The paths that are included in indexing. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + :param indexes: List of indexes for this path + :type indexes: list[~azure.mgmt.cosmosdb.v2015_04_01.models.Indexes] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, + } + + def __init__(self, *, path: str=None, indexes=None, **kwargs) -> None: + super(IncludedPath, self).__init__(**kwargs) + self.path = path + self.indexes = indexes + + +class Indexes(Model): + """The indexes for the path. + + :param data_type: The datatype for which the indexing behavior is applied + to. Possible values include: 'String', 'Number', 'Point', 'Polygon', + 'LineString', 'MultiPolygon'. Default value: "String" . + :type data_type: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.DataType + :param precision: The precision of the index. -1 is maximum precision. + :type precision: int + :param kind: Indicates the type of index. Possible values include: 'Hash', + 'Range', 'Spatial'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexKind + """ + + _attribute_map = { + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'precision': {'key': 'precision', 'type': 'int'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, data_type="String", precision: int=None, kind="Hash", **kwargs) -> None: + super(Indexes, self).__init__(**kwargs) + self.data_type = data_type + self.precision = precision + self.kind = kind + + +class IndexingPolicy(Model): + """Cosmos DB indexing policy. + + :param automatic: Indicates if the indexing policy is automatic + :type automatic: bool + :param indexing_mode: Indicates the indexing mode. Possible values + include: 'Consistent', 'Lazy', 'None'. Default value: "Consistent" . + :type indexing_mode: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingMode + :param included_paths: List of paths to include in the indexing + :type included_paths: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.IncludedPath] + :param excluded_paths: List of paths to exclude from indexing + :type excluded_paths: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.ExcludedPath] + """ + + _attribute_map = { + 'automatic': {'key': 'automatic', 'type': 'bool'}, + 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, + 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, + } + + def __init__(self, *, automatic: bool=None, indexing_mode="Consistent", included_paths=None, excluded_paths=None, **kwargs) -> None: + super(IndexingPolicy, self).__init__(**kwargs) + self.automatic = automatic + self.indexing_mode = indexing_mode + self.included_paths = included_paths + self.excluded_paths = excluded_paths + + +class Location(Model): + """A region in which the Azure Cosmos DB database account is deployed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region within the database account. + Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region. + :type location_name: str + :ivar document_endpoint: The connection endpoint for the specific region. + Example: + https://<accountName>-<locationName>.documents.azure.com:443/ + :vartype document_endpoint: str + :param provisioning_state: + :type provisioning_state: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + :param is_zone_redundant: Flag to indicate whether or not this region is + an AvailabilityZone region + :type is_zone_redundant: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'document_endpoint': {'key': 'documentEndpoint', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + 'is_zone_redundant': {'key': 'isZoneRedundant', 'type': 'bool'}, + } + + def __init__(self, *, location_name: str=None, provisioning_state: str=None, failover_priority: int=None, is_zone_redundant: bool=None, **kwargs) -> None: + super(Location, self).__init__(**kwargs) + self.id = None + self.location_name = location_name + self.document_endpoint = None + self.provisioning_state = provisioning_state + self.failover_priority = failover_priority + self.is_zone_redundant = is_zone_redundant + + +class Metric(Model): + """Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.MetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(Metric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = unit + self.name = None + self.metric_values = None + + +class MetricAvailability(Model): + """The availability of the metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :ivar retention: The retention for the metric values. + :vartype retention: str + """ + + _validation = { + 'time_grain': {'readonly': True}, + 'retention': {'readonly': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'retention': {'key': 'retention', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = None + self.retention = None + + +class MetricDefinition(Model): + """The definition of a metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar metric_availabilities: The list of metric availabilities for the + account. + :vartype metric_availabilities: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.MetricAvailability] + :ivar primary_aggregation_type: The primary aggregation type of the + metric. Possible values include: 'None', 'Average', 'Total', 'Minimum', + 'Maximum', 'Last' + :vartype primary_aggregation_type: str or + ~azure.mgmt.cosmosdb.v2015_04_01.models.PrimaryAggregationType + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar resource_uri: The resource uri of the database. + :vartype resource_uri: str + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + """ + + _validation = { + 'metric_availabilities': {'readonly': True}, + 'primary_aggregation_type': {'readonly': True}, + 'resource_uri': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(MetricDefinition, self).__init__(**kwargs) + self.metric_availabilities = None + self.primary_aggregation_type = None + self.unit = unit + self.resource_uri = None + self.name = None + + +class MetricName(Model): + """A metric name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The name of the metric. + :vartype value: str + :ivar localized_value: The friendly name of the metric. + :vartype localized_value: str + """ + + _validation = { + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(MetricName, self).__init__(**kwargs) + self.value = None + self.localized_value = None + + +class MetricValue(Model): + """Represents metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + } + + def __init__(self, **kwargs) -> None: + super(MetricValue, self).__init__(**kwargs) + self._count = None + self.average = None + self.maximum = None + self.minimum = None + self.timestamp = None + self.total = None + + +class MongoDBCollection(Resource): + """An Azure Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_collection_id: Required. Name of the Cosmos DB MongoDB + collection + :type mongo_db_collection_id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoIndex] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_collection_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_collection_id': {'key': 'properties.id', 'type': 'str'}, + 'shard_key': {'key': 'properties.shardKey', 'type': '{str}'}, + 'indexes': {'key': 'properties.indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, *, mongo_db_collection_id: str, location: str=None, tags=None, shard_key=None, indexes=None, **kwargs) -> None: + super(MongoDBCollection, self).__init__(location=location, tags=tags, **kwargs) + self.mongo_db_collection_id = mongo_db_collection_id + self.shard_key = shard_key + self.indexes = indexes + + +class MongoDBCollectionCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB MongoDB collection. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a MongoDB + collection + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBCollectionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(MongoDBCollectionCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options + + +class MongoDBCollectionResource(Model): + """Cosmos DB MongoDB collection resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB collection + :type id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoIndex] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, *, id: str, shard_key=None, indexes=None, **kwargs) -> None: + super(MongoDBCollectionResource, self).__init__(**kwargs) + self.id = id + self.shard_key = shard_key + self.indexes = indexes + + +class MongoDBDatabase(Resource): + """An Azure Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_database_id: Required. Name of the Cosmos DB MongoDB + database + :type mongo_db_database_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_database_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_database_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, *, mongo_db_database_id: str, location: str=None, tags=None, **kwargs) -> None: + super(MongoDBDatabase, self).__init__(location=location, tags=tags, **kwargs) + self.mongo_db_database_id = mongo_db_database_id + + +class MongoDBDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB MongoDB database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a MongoDB database + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(MongoDBDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options + + +class MongoDBDatabaseResource(Model): + """Cosmos DB MongoDB database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(MongoDBDatabaseResource, self).__init__(**kwargs) + self.id = id + + +class MongoIndex(Model): + """Cosmos DB MongoDB collection index key. + + :param key: Cosmos DB MongoDB collection index keys + :type key: ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoIndexKeys + :param options: Cosmos DB MongoDB collection index key options + :type options: ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoIndexOptions + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, + 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, + } + + def __init__(self, *, key=None, options=None, **kwargs) -> None: + super(MongoIndex, self).__init__(**kwargs) + self.key = key + self.options = options + + +class MongoIndexKeys(Model): + """Cosmos DB MongoDB collection resource object. + + :param keys: List of keys for each MongoDB collection in the Azure Cosmos + DB service + :type keys: list[str] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + } + + def __init__(self, *, keys=None, **kwargs) -> None: + super(MongoIndexKeys, self).__init__(**kwargs) + self.keys = keys + + +class MongoIndexOptions(Model): + """Cosmos DB MongoDB collection index options. + + :param expire_after_seconds: Expire after seconds + :type expire_after_seconds: int + :param unique: Is unique or not + :type unique: bool + """ + + _attribute_map = { + 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, + 'unique': {'key': 'unique', 'type': 'bool'}, + } + + def __init__(self, *, expire_after_seconds: int=None, unique: bool=None, **kwargs) -> None: + super(MongoIndexOptions, self).__init__(**kwargs) + self.expire_after_seconds = expire_after_seconds + self.unique = unique + + +class Operation(Model): + """REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.cosmosdb.v2015_04_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ResourceProvider + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'Provider', 'type': 'str'}, + 'resource': {'key': 'Resource', 'type': 'str'}, + 'operation': {'key': 'Operation', 'type': 'str'}, + 'description': {'key': 'Description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class PartitionMetric(Metric): + """The metric values for a single partition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.MetricValue] + :ivar partition_id: The partition id (GUID identifier) of the metric + values. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the metric values. + :vartype partition_key_range_id: str + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(PartitionMetric, self).__init__(unit=unit, **kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class Usage(Model): + """The usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(Usage, self).__init__(**kwargs) + self.unit = unit + self.name = None + self.quota_period = None + self.limit = None + self.current_value = None + + +class PartitionUsage(Usage): + """The partition level usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + :ivar partition_id: The partition id (GUID identifier) of the usages. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the usages. + :vartype partition_key_range_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(PartitionUsage, self).__init__(unit=unit, **kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class PercentileMetric(Model): + """Percentile Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricName + :ivar metric_values: The percentile metric values for the specified time + window and timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.PercentileMetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[PercentileMetricValue]'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(PercentileMetric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = unit + self.name = None + self.metric_values = None + + +class PercentileMetricValue(MetricValue): + """Represents percentile metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + :ivar p10: The 10th percentile value for the metric. + :vartype p10: float + :ivar p25: The 25th percentile value for the metric. + :vartype p25: float + :ivar p50: The 50th percentile value for the metric. + :vartype p50: float + :ivar p75: The 75th percentile value for the metric. + :vartype p75: float + :ivar p90: The 90th percentile value for the metric. + :vartype p90: float + :ivar p95: The 95th percentile value for the metric. + :vartype p95: float + :ivar p99: The 99th percentile value for the metric. + :vartype p99: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + 'p10': {'readonly': True}, + 'p25': {'readonly': True}, + 'p50': {'readonly': True}, + 'p75': {'readonly': True}, + 'p90': {'readonly': True}, + 'p95': {'readonly': True}, + 'p99': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + 'p10': {'key': 'P10', 'type': 'float'}, + 'p25': {'key': 'P25', 'type': 'float'}, + 'p50': {'key': 'P50', 'type': 'float'}, + 'p75': {'key': 'P75', 'type': 'float'}, + 'p90': {'key': 'P90', 'type': 'float'}, + 'p95': {'key': 'P95', 'type': 'float'}, + 'p99': {'key': 'P99', 'type': 'float'}, + } + + def __init__(self, **kwargs) -> None: + super(PercentileMetricValue, self).__init__(**kwargs) + self.p10 = None + self.p25 = None + self.p50 = None + self.p75 = None + self.p90 = None + self.p95 = None + self.p99 = None + + +class RegionForOnlineOffline(Model): + """Cosmos DB region to online or offline. + + All required parameters must be populated in order to send to Azure. + + :param region: Required. Cosmos DB region, with spaces between words and + each word capitalized. + :type region: str + """ + + _validation = { + 'region': {'required': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, *, region: str, **kwargs) -> None: + super(RegionForOnlineOffline, self).__init__(**kwargs) + self.region = region + + +class SqlContainer(Resource): + """An Azure Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_container_id: Required. Name of the Cosmos DB SQL container + :type sql_container_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionPolicy + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_container_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_container_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, sql_container_id: str, location: str=None, tags=None, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, _rid: str=None, _ts=None, _etag: str=None, **kwargs) -> None: + super(SqlContainer, self).__init__(location=location, tags=tags, **kwargs) + self.sql_container_id = sql_container_id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + self._rid = _rid + self._ts = _ts + self._etag = _etag + + +class SqlContainerCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB container. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a container + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlContainerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'SqlContainerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(SqlContainerCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options + + +class SqlContainerResource(Model): + """Cosmos DB SQL container resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL container + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, *, id: str, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(SqlContainerResource, self).__init__(**kwargs) + self.id = id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + + +class SqlDatabase(Resource): + """An Azure Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_database_id: Required. Name of the Cosmos DB SQL database + :type sql_database_id: str + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + :param _colls: A system generated property that specified the addressable + path of the collections resource. + :type _colls: str + :param _users: A system generated property that specifies the addressable + path of the users resource. + :type _users: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_database_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_database_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + '_colls': {'key': 'properties._colls', 'type': 'str'}, + '_users': {'key': 'properties._users', 'type': 'str'}, + } + + def __init__(self, *, sql_database_id: str, location: str=None, tags=None, _rid: str=None, _ts=None, _etag: str=None, _colls: str=None, _users: str=None, **kwargs) -> None: + super(SqlDatabase, self).__init__(location=location, tags=tags, **kwargs) + self.sql_database_id = sql_database_id + self._rid = _rid + self._ts = _ts + self._etag = _etag + self._colls = _colls + self._users = _users + + +class SqlDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB SQL database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a SQL database + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(SqlDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options + + +class SqlDatabaseResource(Model): + """Cosmos DB SQL database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(SqlDatabaseResource, self).__init__(**kwargs) + self.id = id + + +class Table(Resource): + """An Azure Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param table_id: Required. Name of the Cosmos DB table + :type table_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'table_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'table_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, *, table_id: str, location: str=None, tags=None, **kwargs) -> None: + super(Table, self).__init__(location=location, tags=tags, **kwargs) + self.table_id = table_id + + +class TableCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Table. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Table + :type resource: ~azure.mgmt.cosmosdb.v2015_04_01.models.TableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'TableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(TableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options + + +class TableResource(Model): + """Cosmos DB table id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB table + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(TableResource, self).__init__(**kwargs) + self.id = id + + +class Throughput(Resource): + """An Azure Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'throughput': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'throughput': {'key': 'properties.throughput', 'type': 'int'}, + } + + def __init__(self, *, throughput: int, location: str=None, tags=None, **kwargs) -> None: + super(Throughput, self).__init__(location=location, tags=tags, **kwargs) + self.throughput = throughput + + +class ThroughputResource(Model): + """Cosmos DB resource throughput object. + + All required parameters must be populated in order to send to Azure. + + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + """ + + _validation = { + 'throughput': {'required': True}, + } + + _attribute_map = { + 'throughput': {'key': 'throughput', 'type': 'int'}, + } + + def __init__(self, *, throughput: int, **kwargs) -> None: + super(ThroughputResource, self).__init__(**kwargs) + self.throughput = throughput + + +class ThroughputUpdateParameters(Model): + """Parameters to update Cosmos DB resource throughput. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a resource + throughput + :type resource: ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + """ + + _validation = { + 'resource': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'ThroughputResource'}, + } + + def __init__(self, *, resource, **kwargs) -> None: + super(ThroughputUpdateParameters, self).__init__(**kwargs) + self.resource = resource + + +class UniqueKey(Model): + """The unique key on that enforces uniqueness constraint on documents in the + collection in the Azure Cosmos DB service. + + :param paths: List of paths must be unique for each document in the Azure + Cosmos DB service + :type paths: list[str] + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + } + + def __init__(self, *, paths=None, **kwargs) -> None: + super(UniqueKey, self).__init__(**kwargs) + self.paths = paths + + +class UniqueKeyPolicy(Model): + """The unique key policy configuration for specifying uniqueness constraints + on documents in the collection in the Azure Cosmos DB service. + + :param unique_keys: List of unique keys on that enforces uniqueness + constraint on documents in the collection in the Azure Cosmos DB service. + :type unique_keys: list[~azure.mgmt.cosmosdb.v2015_04_01.models.UniqueKey] + """ + + _attribute_map = { + 'unique_keys': {'key': 'uniqueKeys', 'type': '[UniqueKey]'}, + } + + def __init__(self, *, unique_keys=None, **kwargs) -> None: + super(UniqueKeyPolicy, self).__init__(**kwargs) + self.unique_keys = unique_keys + + +class VirtualNetworkRule(Model): + """Virtual Network ACL Rule object. + + :param id: Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :type id: str + :param ignore_missing_vnet_service_endpoint: Create firewall rule before + the virtual network has vnet service endpoint enabled. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVNetServiceEndpoint', 'type': 'bool'}, + } + + def __init__(self, *, id: str=None, ignore_missing_vnet_service_endpoint: bool=None, **kwargs) -> None: + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = id + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_paged_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_paged_models.py new file mode 100644 index 000000000000..521650305e80 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/models/_paged_models.py @@ -0,0 +1,235 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class DatabaseAccountPaged(Paged): + """ + A paging container for iterating over a list of :class:`DatabaseAccount ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DatabaseAccount]'} + } + + def __init__(self, *args, **kwargs): + + super(DatabaseAccountPaged, self).__init__(*args, **kwargs) +class MetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`Metric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Metric]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricPaged, self).__init__(*args, **kwargs) +class UsagePaged(Paged): + """ + A paging container for iterating over a list of :class:`Usage ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Usage]'} + } + + def __init__(self, *args, **kwargs): + + super(UsagePaged, self).__init__(*args, **kwargs) +class MetricDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricDefinitionPaged, self).__init__(*args, **kwargs) +class SqlDatabasePaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlDatabase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlDatabase]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlDatabasePaged, self).__init__(*args, **kwargs) +class SqlContainerPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlContainer ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlContainer]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlContainerPaged, self).__init__(*args, **kwargs) +class MongoDBDatabasePaged(Paged): + """ + A paging container for iterating over a list of :class:`MongoDBDatabase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MongoDBDatabase]'} + } + + def __init__(self, *args, **kwargs): + + super(MongoDBDatabasePaged, self).__init__(*args, **kwargs) +class MongoDBCollectionPaged(Paged): + """ + A paging container for iterating over a list of :class:`MongoDBCollection ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MongoDBCollection]'} + } + + def __init__(self, *args, **kwargs): + + super(MongoDBCollectionPaged, self).__init__(*args, **kwargs) +class TablePaged(Paged): + """ + A paging container for iterating over a list of :class:`Table ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Table]'} + } + + def __init__(self, *args, **kwargs): + + super(TablePaged, self).__init__(*args, **kwargs) +class CassandraKeyspacePaged(Paged): + """ + A paging container for iterating over a list of :class:`CassandraKeyspace ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CassandraKeyspace]'} + } + + def __init__(self, *args, **kwargs): + + super(CassandraKeyspacePaged, self).__init__(*args, **kwargs) +class CassandraTablePaged(Paged): + """ + A paging container for iterating over a list of :class:`CassandraTable ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CassandraTable]'} + } + + def __init__(self, *args, **kwargs): + + super(CassandraTablePaged, self).__init__(*args, **kwargs) +class GremlinDatabasePaged(Paged): + """ + A paging container for iterating over a list of :class:`GremlinDatabase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GremlinDatabase]'} + } + + def __init__(self, *args, **kwargs): + + super(GremlinDatabasePaged, self).__init__(*args, **kwargs) +class GremlinGraphPaged(Paged): + """ + A paging container for iterating over a list of :class:`GremlinGraph ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GremlinGraph]'} + } + + def __init__(self, *args, **kwargs): + + super(GremlinGraphPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class PercentileMetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`PercentileMetric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PercentileMetric]'} + } + + def __init__(self, *args, **kwargs): + + super(PercentileMetricPaged, self).__init__(*args, **kwargs) +class PartitionMetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`PartitionMetric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PartitionMetric]'} + } + + def __init__(self, *args, **kwargs): + + super(PartitionMetricPaged, self).__init__(*args, **kwargs) +class PartitionUsagePaged(Paged): + """ + A paging container for iterating over a list of :class:`PartitionUsage ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PartitionUsage]'} + } + + def __init__(self, *args, **kwargs): + + super(PartitionUsagePaged, self).__init__(*args, **kwargs) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/__init__.py new file mode 100644 index 000000000000..5b015813966f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/__init__.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._database_accounts_operations import DatabaseAccountsOperations +from ._operations import Operations +from ._database_operations import DatabaseOperations +from ._collection_operations import CollectionOperations +from ._collection_region_operations import CollectionRegionOperations +from ._database_account_region_operations import DatabaseAccountRegionOperations +from ._percentile_source_target_operations import PercentileSourceTargetOperations +from ._percentile_target_operations import PercentileTargetOperations +from ._percentile_operations import PercentileOperations +from ._collection_partition_region_operations import CollectionPartitionRegionOperations +from ._collection_partition_operations import CollectionPartitionOperations +from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations +from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations + +__all__ = [ + 'DatabaseAccountsOperations', + 'Operations', + 'DatabaseOperations', + 'CollectionOperations', + 'CollectionRegionOperations', + 'DatabaseAccountRegionOperations', + 'PercentileSourceTargetOperations', + 'PercentileTargetOperations', + 'PercentileOperations', + 'CollectionPartitionRegionOperations', + 'CollectionPartitionOperations', + 'PartitionKeyRangeIdOperations', + 'PartitionKeyRangeIdRegionOperations', +] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_operations.py new file mode 100644 index 000000000000..489ce93b5913 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_operations.py @@ -0,0 +1,288 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionOperations(object): + """CollectionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account and collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics'} + + def list_usages( + self, resource_group_name, account_name, database_rid, collection_rid, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent storage data) for the given + collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UsagePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Usage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages'} + + def list_metric_definitions( + self, resource_group_name, account_name, database_rid, collection_rid, custom_headers=None, raw=False, **operation_config): + """Retrieves metric definitions for the given collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricDefinitionPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.MetricDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_partition_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_partition_operations.py new file mode 100644 index 000000000000..6ec61df07427 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_partition_operations.py @@ -0,0 +1,210 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionPartitionOperations(object): + """CollectionPartitionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + collection, split by partition. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics'} + + def list_usages( + self, resource_group_name, account_name, database_rid, collection_rid, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent storage data) for the given + collection, split by partition. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionUsage + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionUsagePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionUsage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionUsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_partition_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_partition_region_operations.py new file mode 100644 index 000000000000..716b9dd2628c --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_partition_region_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionPartitionRegionOperations(object): + """CollectionPartitionRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + collection and region, split by partition. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_region_operations.py new file mode 100644 index 000000000000..d0c76529f63f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_collection_region_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionRegionOperations(object): + """CollectionRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account, collection and region. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_database_account_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_database_account_region_operations.py new file mode 100644 index 000000000000..63cfb041caae --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_database_account_region_operations.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class DatabaseAccountRegionOperations(object): + """DatabaseAccountRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account and region. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_database_accounts_operations.py new file mode 100644 index 000000000000..63b2491c5f61 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_database_accounts_operations.py @@ -0,0 +1,6046 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class DatabaseAccountsOperations(object): + """DatabaseAccountsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def get( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Retrieves the properties of an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccount or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccount or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _patch_initial( + self, resource_group_name, account_name, tags=None, capabilities=None, custom_headers=None, raw=False, **operation_config): + update_parameters = models.DatabaseAccountPatchParameters(tags=tags, capabilities=capabilities) + + # Construct URL + url = self.patch.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_parameters, 'DatabaseAccountPatchParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def patch( + self, resource_group_name, account_name, tags=None, capabilities=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Patches the properties of an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param tags: + :type tags: dict[str, str] + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.Capability] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns DatabaseAccount or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccount] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccount]] + :raises: :class:`CloudError` + """ + raw_result = self._patch_initial( + resource_group_name=resource_group_name, + account_name=account_name, + tags=tags, + capabilities=capabilities, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DatabaseAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _create_or_update_initial( + self, resource_group_name, account_name, create_update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_parameters, 'DatabaseAccountCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, account_name, create_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates an Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param create_update_parameters: The parameters to provide for the + current database account. + :type create_update_parameters: + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns DatabaseAccount or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccount] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccount]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + create_update_parameters=create_update_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DatabaseAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _delete_initial( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, account_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _failover_priority_change_initial( + self, resource_group_name, account_name, failover_policies, custom_headers=None, raw=False, **operation_config): + failover_parameters = models.FailoverPolicies(failover_policies=failover_policies) + + # Construct URL + url = self.failover_priority_change.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(failover_parameters, 'FailoverPolicies') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def failover_priority_change( + self, resource_group_name, account_name, failover_policies, custom_headers=None, raw=False, polling=True, **operation_config): + """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. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param failover_policies: List of failover policies. + :type failover_policies: + list[~azure.mgmt.cosmosdb.v2015_04_01.models.FailoverPolicy] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._failover_priority_change_initial( + resource_group_name=resource_group_name, + account_name=account_name, + failover_policies=failover_policies, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + failover_priority_change.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the Azure Cosmos DB database accounts available under the + subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DatabaseAccount + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccount] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DatabaseAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists all the Azure Cosmos DB database accounts available under the + given resource group. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DatabaseAccount + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccount] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DatabaseAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts'} + + def list_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the access keys for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListKeysResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountListKeysResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys'} + + def list_connection_strings( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the connection strings for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListConnectionStringsResult or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountListConnectionStringsResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_connection_strings.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListConnectionStringsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings'} + + + def _offline_region_initial( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, **operation_config): + region_parameter_for_offline = models.RegionForOnlineOffline(region=region) + + # Construct URL + url = self.offline_region.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(region_parameter_for_offline, 'RegionForOnlineOffline') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def offline_region( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, polling=True, **operation_config): + """Offline the specified region for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._offline_region_initial( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + offline_region.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion'} + + + def _online_region_initial( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, **operation_config): + region_parameter_for_online = models.RegionForOnlineOffline(region=region) + + # Construct URL + url = self.online_region.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(region_parameter_for_online, 'RegionForOnlineOffline') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def online_region( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, polling=True, **operation_config): + """Online the specified region for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._online_region_initial( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + online_region.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion'} + + def get_read_only_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the read-only access keys for the specified Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListReadOnlyKeysResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountListReadOnlyKeysResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_read_only_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListReadOnlyKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_read_only_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys'} + + def list_read_only_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the read-only access keys for the specified Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListReadOnlyKeysResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.DatabaseAccountListReadOnlyKeysResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_read_only_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListReadOnlyKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_read_only_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys'} + + + def _regenerate_key_initial( + self, resource_group_name, account_name, key_kind, custom_headers=None, raw=False, **operation_config): + key_to_regenerate = models.DatabaseAccountRegenerateKeyParameters(key_kind=key_kind) + + # Construct URL + url = self.regenerate_key.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(key_to_regenerate, 'DatabaseAccountRegenerateKeyParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def regenerate_key( + self, resource_group_name, account_name, key_kind, custom_headers=None, raw=False, polling=True, **operation_config): + """Regenerates an access key for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param key_kind: The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', + 'secondaryReadonly' + :type key_kind: str or ~azure.mgmt.cosmosdb.v2015_04_01.models.KeyKind + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._regenerate_key_initial( + resource_group_name=resource_group_name, + account_name=account_name, + key_kind=key_kind, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey'} + + def check_name_exists( + self, account_name, custom_headers=None, raw=False, **operation_config): + """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. + + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: bool or ClientRawResponse if raw=true + :rtype: bool or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_name_exists.metadata['url'] + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = (response.status_code == 200) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + return deserialized + check_name_exists.metadata = {'url': '/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}'} + + def list_metrics( + self, resource_group_name, account_name, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics'} + + def list_usages( + self, resource_group_name, account_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent data) for the given database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UsagePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Usage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages'} + + def list_metric_definitions( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Retrieves metric definitions for the given database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricDefinitionPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.MetricDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions'} + + def list_sql_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlDatabase + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlDatabasePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.SqlDatabase] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_databases.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlDatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases'} + + def get_sql_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL database under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlDatabase or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlDatabase or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}'} + + + def _create_update_sql_database_initial( + self, resource_group_name, account_name, database_name, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_sql_database_parameters = models.SqlDatabaseCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_sql_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_database_parameters, 'SqlDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_database( + self, resource_group_name, account_name, database_name, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param resource: The standard JSON format of a SQL database + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlDatabaseResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SqlDatabase or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.SqlDatabase] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.SqlDatabase]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}'} + + + def _delete_sql_database_initial( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}'} + + def get_sql_database_throughput( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the SQL database under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Throughput or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}/settings/throughput'} + + + def _update_sql_database_throughput_initial( + self, resource_group_name, account_name, database_name, resource, custom_headers=None, raw=False, **operation_config): + update_throughput_parameters = models.ThroughputUpdateParameters(resource=resource) + + # Construct URL + url = self.update_sql_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_sql_database_throughput( + self, resource_group_name, account_name, database_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param resource: The standard JSON format of a resource throughput + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Throughput or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput]] + :raises: :class:`CloudError` + """ + raw_result = self._update_sql_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + resource=resource, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_sql_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}/settings/throughput'} + + def list_sql_containers( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlContainer + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlContainerPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.SqlContainer] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_containers.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlContainerPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}/containers'} + + def get_sql_container( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlContainer or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlContainer or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_container.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlContainer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}/containers/{containerName}'} + + + def _create_update_sql_container_initial( + self, resource_group_name, account_name, database_name, container_name, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_sql_container_parameters = models.SqlContainerCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_sql_container.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_container_parameters, 'SqlContainerCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlContainer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_container( + self, resource_group_name, account_name, database_name, container_name, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param resource: The standard JSON format of a container + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.SqlContainerResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SqlContainer or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.SqlContainer] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.SqlContainer]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlContainer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}/containers/{containerName}'} + + + def _delete_sql_container_initial( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_container.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_container( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}/containers/{containerName}'} + + def get_sql_container_throughput( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the SQL container under an existing Azure + Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Throughput or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_container_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_container_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}/containers/{containerName}/settings/throughput'} + + + def _update_sql_container_throughput_initial( + self, resource_group_name, account_name, database_name, container_name, resource, custom_headers=None, raw=False, **operation_config): + update_throughput_parameters = models.ThroughputUpdateParameters(resource=resource) + + # Construct URL + url = self.update_sql_container_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_sql_container_throughput( + self, resource_group_name, account_name, database_name, container_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param resource: The standard JSON format of a resource throughput + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Throughput or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput]] + :raises: :class:`CloudError` + """ + raw_result = self._update_sql_container_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + resource=resource, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_sql_container_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName}/containers/{containerName}/settings/throughput'} + + def list_mongo_db_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the MongoDB databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MongoDBDatabase + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBDatabasePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBDatabase] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_mongo_db_databases.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MongoDBDatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_mongo_db_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases'} + + def get_mongo_db_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the MongoDB databases under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MongoDBDatabase or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBDatabase or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MongoDBDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}'} + + + def _create_update_mongo_db_database_initial( + self, resource_group_name, account_name, database_name, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_mongo_db_database_parameters = models.MongoDBDatabaseCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_mongo_db_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_mongo_db_database_parameters, 'MongoDBDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MongoDBDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_mongo_db_database( + self, resource_group_name, account_name, database_name, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or updates Azure Cosmos DB MongoDB database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param resource: The standard JSON format of a MongoDB database + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBDatabaseResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns MongoDBDatabase or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBDatabase] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBDatabase]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_mongo_db_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('MongoDBDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_mongo_db_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}'} + + + def _delete_mongo_db_database_initial( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_mongo_db_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_mongo_db_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB MongoDB database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_mongo_db_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_mongo_db_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}'} + + def get_mongo_db_database_throughput( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the MongoDB database under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Throughput or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}/settings/throughput'} + + + def _update_mongo_db_database_throughput_initial( + self, resource_group_name, account_name, database_name, resource, custom_headers=None, raw=False, **operation_config): + update_throughput_parameters = models.ThroughputUpdateParameters(resource=resource) + + # Construct URL + url = self.update_mongo_db_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_mongo_db_database_throughput( + self, resource_group_name, account_name, database_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of the an Azure Cosmos DB MongoDB database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param resource: The standard JSON format of a resource throughput + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Throughput or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput]] + :raises: :class:`CloudError` + """ + raw_result = self._update_mongo_db_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + resource=resource, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_mongo_db_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}/settings/throughput'} + + def list_mongo_db_collections( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the MongoDB collection under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MongoDBCollection + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBCollectionPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBCollection] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_mongo_db_collections.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MongoDBCollectionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_mongo_db_collections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}/collections'} + + def get_mongo_db_collection( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, **operation_config): + """Gets the MongoDB collection under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MongoDBCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBCollection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_collection.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MongoDBCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}/collections/{collectionName}'} + + + def _create_update_mongo_db_collection_initial( + self, resource_group_name, account_name, database_name, collection_name, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_mongo_db_collection_parameters = models.MongoDBCollectionCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_mongo_db_collection.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_mongo_db_collection_parameters, 'MongoDBCollectionCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MongoDBCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_mongo_db_collection( + self, resource_group_name, account_name, database_name, collection_name, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB MongoDB Collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param resource: The standard JSON format of a MongoDB collection + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBCollectionResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns MongoDBCollection or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBCollection] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.MongoDBCollection]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_mongo_db_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('MongoDBCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}/collections/{collectionName}'} + + + def _delete_mongo_db_collection_initial( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_mongo_db_collection.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_mongo_db_collection( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB MongoDB Collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_mongo_db_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}/collections/{collectionName}'} + + def get_mongo_db_collection_throughput( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the MongoDB collection under an existing + Azure Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Throughput or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_collection_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_collection_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}/collections/{collectionName}/settings/throughput'} + + + def _update_mongo_db_collection_throughput_initial( + self, resource_group_name, account_name, database_name, collection_name, resource, custom_headers=None, raw=False, **operation_config): + update_throughput_parameters = models.ThroughputUpdateParameters(resource=resource) + + # Construct URL + url = self.update_mongo_db_collection_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_mongo_db_collection_throughput( + self, resource_group_name, account_name, database_name, collection_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param resource: The standard JSON format of a resource throughput + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Throughput or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput]] + :raises: :class:`CloudError` + """ + raw_result = self._update_mongo_db_collection_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + resource=resource, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_mongo_db_collection_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongodb/databases/{databaseName}/collections/{collectionName}/settings/throughput'} + + def list_tables( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Tables under an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Table + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.TablePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Table] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_tables.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TablePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_tables.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables'} + + def get_table( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the Tables under an existing Azure Cosmos DB database account with + the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Table or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Table or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Table', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables/{tableName}'} + + + def _create_update_table_initial( + self, resource_group_name, account_name, table_name, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_table_parameters = models.TableCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_table_parameters, 'TableCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Table', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_table( + self, resource_group_name, account_name, table_name, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param resource: The standard JSON format of a Table + :type resource: ~azure.mgmt.cosmosdb.v2015_04_01.models.TableResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Table or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Table] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Table]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Table', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables/{tableName}'} + + + def _delete_table_initial( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_table( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables/{tableName}'} + + def get_table_throughput( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Table under an existing Azure Cosmos DB + database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Throughput or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables/{tableName}/settings/throughput'} + + + def _update_table_throughput_initial( + self, resource_group_name, account_name, table_name, resource, custom_headers=None, raw=False, **operation_config): + update_throughput_parameters = models.ThroughputUpdateParameters(resource=resource) + + # Construct URL + url = self.update_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_table_throughput( + self, resource_group_name, account_name, table_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param resource: The standard JSON format of a resource throughput + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Throughput or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput]] + :raises: :class:`CloudError` + """ + raw_result = self._update_table_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + resource=resource, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables/{tableName}/settings/throughput'} + + def list_cassandra_keyspaces( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Cassandra keyspaces under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of CassandraKeyspace + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraKeyspacePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraKeyspace] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_cassandra_keyspaces.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.CassandraKeyspacePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_cassandra_keyspaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces'} + + def get_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CassandraKeyspace or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraKeyspace or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_keyspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CassandraKeyspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}'} + + + def _create_update_cassandra_keyspace_initial( + self, resource_group_name, account_name, keyspace_name, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_cassandra_keyspace_parameters = models.CassandraKeyspaceCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_cassandra_keyspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_cassandra_keyspace_parameters, 'CassandraKeyspaceCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CassandraKeyspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_name, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Cassandra keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param resource: The standard JSON format of a Cassandra keyspace + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraKeyspaceResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns CassandraKeyspace or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraKeyspace] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraKeyspace]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_cassandra_keyspace_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CassandraKeyspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}'} + + + def _delete_cassandra_keyspace_initial( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_cassandra_keyspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Cassandra keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_cassandra_keyspace_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}'} + + def get_cassandra_keyspace_throughput( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Cassandra Keyspace under an existing + Azure Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Throughput or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_keyspace_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_keyspace_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}/settings/throughput'} + + + def _update_cassandra_keyspace_throughput_initial( + self, resource_group_name, account_name, keyspace_name, resource, custom_headers=None, raw=False, **operation_config): + update_throughput_parameters = models.ThroughputUpdateParameters(resource=resource) + + # Construct URL + url = self.update_cassandra_keyspace_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_cassandra_keyspace_throughput( + self, resource_group_name, account_name, keyspace_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param resource: The standard JSON format of a resource throughput + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Throughput or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput]] + :raises: :class:`CloudError` + """ + raw_result = self._update_cassandra_keyspace_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + resource=resource, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_cassandra_keyspace_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}/settings/throughput'} + + def list_cassandra_tables( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + """Lists the Cassandra table under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of CassandraTable + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraTablePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraTable] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_cassandra_tables.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.CassandraTablePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_cassandra_tables.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}/tables'} + + def get_cassandra_table( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the Cassandra table under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CassandraTable or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraTable or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CassandraTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}/tables/{tableName}'} + + + def _create_update_cassandra_table_initial( + self, resource_group_name, account_name, keyspace_name, table_name, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_cassandra_table_parameters = models.CassandraTableCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_cassandra_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_cassandra_table_parameters, 'CassandraTableCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CassandraTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_cassandra_table( + self, resource_group_name, account_name, keyspace_name, table_name, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Cassandra Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param resource: The standard JSON format of a Cassandra table + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraTableResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns CassandraTable or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraTable] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.CassandraTable]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_cassandra_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + table_name=table_name, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CassandraTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}/tables/{tableName}'} + + + def _delete_cassandra_table_initial( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_cassandra_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_cassandra_table( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Cassandra table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_cassandra_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + table_name=table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}/tables/{tableName}'} + + def get_cassandra_table_throughput( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Cassandra table under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Throughput or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}/tables/{tableName}/settings/throughput'} + + + def _update_cassandra_table_throughput_initial( + self, resource_group_name, account_name, keyspace_name, table_name, resource, custom_headers=None, raw=False, **operation_config): + update_throughput_parameters = models.ThroughputUpdateParameters(resource=resource) + + # Construct URL + url = self.update_cassandra_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_cassandra_table_throughput( + self, resource_group_name, account_name, keyspace_name, table_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Cassandra table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param resource: The standard JSON format of a resource throughput + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Throughput or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput]] + :raises: :class:`CloudError` + """ + raw_result = self._update_cassandra_table_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + table_name=table_name, + resource=resource, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_cassandra_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceName}/tables/{tableName}/settings/throughput'} + + def list_gremlin_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Gremlin databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GremlinDatabase + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinDatabasePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinDatabase] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_gremlin_databases.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GremlinDatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_gremlin_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases'} + + def get_gremlin_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin databases under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GremlinDatabase or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinDatabase or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GremlinDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}'} + + + def _create_update_gremlin_database_initial( + self, resource_group_name, account_name, database_name, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_gremlin_database_parameters = models.GremlinDatabaseCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_gremlin_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_gremlin_database_parameters, 'GremlinDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GremlinDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_gremlin_database( + self, resource_group_name, account_name, database_name, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param resource: The standard JSON format of a Gremlin database + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinDatabaseResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns GremlinDatabase or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinDatabase] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinDatabase]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GremlinDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}'} + + + def _delete_gremlin_database_initial( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_gremlin_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_gremlin_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}'} + + def get_gremlin_database_throughput( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Gremlin database under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Throughput or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}/settings/throughput'} + + + def _update_gremlin_database_throughput_initial( + self, resource_group_name, account_name, database_name, resource, custom_headers=None, raw=False, **operation_config): + update_throughput_parameters = models.ThroughputUpdateParameters(resource=resource) + + # Construct URL + url = self.update_gremlin_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_gremlin_database_throughput( + self, resource_group_name, account_name, database_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param resource: The standard JSON format of a resource throughput + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Throughput or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput]] + :raises: :class:`CloudError` + """ + raw_result = self._update_gremlin_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + resource=resource, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_gremlin_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}/settings/throughput'} + + def list_gremlin_graphs( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the Gremlin graph under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GremlinGraph + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinGraphPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinGraph] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_gremlin_graphs.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GremlinGraphPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_gremlin_graphs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}/graphs'} + + def get_gremlin_graph( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin graph under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GremlinGraph or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinGraph or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_graph.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GremlinGraph', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_graph.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}/graphs/{graphName}'} + + + def _create_update_gremlin_graph_initial( + self, resource_group_name, account_name, database_name, graph_name, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_gremlin_graph_parameters = models.GremlinGraphCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_gremlin_graph.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_gremlin_graph_parameters, 'GremlinGraphCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GremlinGraph', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_gremlin_graph( + self, resource_group_name, account_name, database_name, graph_name, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param resource: The standard JSON format of a Gremlin graph + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinGraphResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns GremlinGraph or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinGraph] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.GremlinGraph]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_gremlin_graph_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GremlinGraph', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_gremlin_graph.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}/graphs/{graphName}'} + + + def _delete_gremlin_graph_initial( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_gremlin_graph.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_gremlin_graph( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Gremlin graph. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_gremlin_graph_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_gremlin_graph.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}/graphs/{graphName}'} + + def get_gremlin_graph_throughput( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin graph throughput under an existing Azure Cosmos DB + database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Throughput or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_graph_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_graph_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}/graphs/{graphName}/settings/throughput'} + + + def _update_gremlin_graph_throughput_initial( + self, resource_group_name, account_name, database_name, graph_name, resource, custom_headers=None, raw=False, **operation_config): + update_throughput_parameters = models.ThroughputUpdateParameters(resource=resource) + + # Construct URL + url = self.update_gremlin_graph_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_gremlin_graph_throughput( + self, resource_group_name, account_name, database_name, graph_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param resource: The standard JSON format of a resource throughput + :type resource: + ~azure.mgmt.cosmosdb.v2015_04_01.models.ThroughputResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Throughput or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2015_04_01.models.Throughput]] + :raises: :class:`CloudError` + """ + raw_result = self._update_gremlin_graph_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + resource=resource, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Throughput', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_gremlin_graph_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseName}/graphs/{graphName}/settings/throughput'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_database_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_database_operations.py new file mode 100644 index 000000000000..8496e1e6532b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_database_operations.py @@ -0,0 +1,278 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class DatabaseOperations(object): + """DatabaseOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account and database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics'} + + def list_usages( + self, resource_group_name, account_name, database_rid, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent data) for the given database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.UsagePaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Usage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages'} + + def list_metric_definitions( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + """Retrieves metric definitions for the given database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.MetricDefinitionPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.MetricDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_operations.py new file mode 100644 index 000000000000..8f79d8b7c078 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_operations.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Cosmos DB Resource Provider operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.OperationPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.Operation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.DocumentDB/operations'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_partition_key_range_id_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_partition_key_range_id_operations.py new file mode 100644 index 000000000000..3b2e4a80add3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_partition_key_range_id_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PartitionKeyRangeIdOperations(object): + """PartitionKeyRangeIdOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, collection_rid, partition_key_range_id, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + partition key range id. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get + data. + :type partition_key_range_id: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str'), + 'partitionKeyRangeId': self._serialize.url("partition_key_range_id", partition_key_range_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_partition_key_range_id_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_partition_key_range_id_region_operations.py new file mode 100644 index 000000000000..96641f56c438 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_partition_key_range_id_region_operations.py @@ -0,0 +1,133 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PartitionKeyRangeIdRegionOperations(object): + """PartitionKeyRangeIdRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, database_rid, collection_rid, partition_key_range_id, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + partition key range id and region. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get + data. + :type partition_key_range_id: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str'), + 'partitionKeyRangeId': self._serialize.url("partition_key_range_id", partition_key_range_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_percentile_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_percentile_operations.py new file mode 100644 index 000000000000..881493be52a3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_percentile_operations.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PercentileOperations(object): + """PercentileOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account. This url is only for PBS and Replication Latency + data. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PercentileMetric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.PercentileMetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.PercentileMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PercentileMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_percentile_source_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_percentile_source_target_operations.py new file mode 100644 index 000000000000..6c67ee881b57 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_percentile_source_target_operations.py @@ -0,0 +1,128 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PercentileSourceTargetOperations(object): + """PercentileSourceTargetOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, source_region, target_region, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + account, source and target region. This url is only for PBS and + Replication Latency data. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param source_region: Source region from which data is written. Cosmos + DB region, with spaces between words and each word capitalized. + :type source_region: str + :param target_region: Target region to which data is written. Cosmos + DB region, with spaces between words and each word capitalized. + :type target_region: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PercentileMetric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.PercentileMetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.PercentileMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'sourceRegion': self._serialize.url("source_region", source_region, 'str'), + 'targetRegion': self._serialize.url("target_region", target_region, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PercentileMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_percentile_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_percentile_target_operations.py new file mode 100644 index 000000000000..569871659bbb --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/operations/_percentile_target_operations.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PercentileTargetOperations(object): + """PercentileTargetOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, target_region, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + account target region. This url is only for PBS and Replication Latency + data. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param target_region: Target region to which data is written. Cosmos + DB region, with spaces between words and each word capitalized. + :type target_region: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PercentileMetric + :rtype: + ~azure.mgmt.cosmosdb.v2015_04_01.models.PercentileMetricPaged[~azure.mgmt.cosmosdb.v2015_04_01.models.PercentileMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'targetRegion': self._serialize.url("target_region", target_region, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PercentileMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/version.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/version.py new file mode 100644 index 000000000000..64f8335c3ba7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2015_04_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2015-04-08" + diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/__init__.py new file mode 100644 index 000000000000..9edd8273e121 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import CosmosDBConfiguration +from ._cosmos_db import CosmosDB +__all__ = ['CosmosDB', 'CosmosDBConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/_configuration.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/_configuration.py new file mode 100644 index 000000000000..f1a57c614ec1 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/_configuration.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class CosmosDBConfiguration(AzureConfiguration): + """Configuration for CosmosDB + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(CosmosDBConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-cosmosdb/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/_cosmos_db.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/_cosmos_db.py new file mode 100644 index 000000000000..74bf2fcbff44 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/_cosmos_db.py @@ -0,0 +1,134 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import CosmosDBConfiguration +from .operations import DatabaseAccountsOperations +from .operations import Operations +from .operations import DatabaseOperations +from .operations import CollectionOperations +from .operations import CollectionRegionOperations +from .operations import DatabaseAccountRegionOperations +from .operations import PercentileSourceTargetOperations +from .operations import PercentileTargetOperations +from .operations import PercentileOperations +from .operations import CollectionPartitionRegionOperations +from .operations import CollectionPartitionOperations +from .operations import PartitionKeyRangeIdOperations +from .operations import PartitionKeyRangeIdRegionOperations +from .operations import SqlResourcesOperations +from .operations import MongoDBResourcesOperations +from .operations import TableResourcesOperations +from .operations import CassandraResourcesOperations +from .operations import GremlinResourcesOperations +from . import models + + +class CosmosDB(SDKClient): + """Azure Cosmos DB Database Service Resource Provider REST API + + :ivar config: Configuration for client. + :vartype config: CosmosDBConfiguration + + :ivar database_accounts: DatabaseAccounts operations + :vartype database_accounts: azure.mgmt.cosmosdb.v2019_08_01.operations.DatabaseAccountsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.cosmosdb.v2019_08_01.operations.Operations + :ivar database: Database operations + :vartype database: azure.mgmt.cosmosdb.v2019_08_01.operations.DatabaseOperations + :ivar collection: Collection operations + :vartype collection: azure.mgmt.cosmosdb.v2019_08_01.operations.CollectionOperations + :ivar collection_region: CollectionRegion operations + :vartype collection_region: azure.mgmt.cosmosdb.v2019_08_01.operations.CollectionRegionOperations + :ivar database_account_region: DatabaseAccountRegion operations + :vartype database_account_region: azure.mgmt.cosmosdb.v2019_08_01.operations.DatabaseAccountRegionOperations + :ivar percentile_source_target: PercentileSourceTarget operations + :vartype percentile_source_target: azure.mgmt.cosmosdb.v2019_08_01.operations.PercentileSourceTargetOperations + :ivar percentile_target: PercentileTarget operations + :vartype percentile_target: azure.mgmt.cosmosdb.v2019_08_01.operations.PercentileTargetOperations + :ivar percentile: Percentile operations + :vartype percentile: azure.mgmt.cosmosdb.v2019_08_01.operations.PercentileOperations + :ivar collection_partition_region: CollectionPartitionRegion operations + :vartype collection_partition_region: azure.mgmt.cosmosdb.v2019_08_01.operations.CollectionPartitionRegionOperations + :ivar collection_partition: CollectionPartition operations + :vartype collection_partition: azure.mgmt.cosmosdb.v2019_08_01.operations.CollectionPartitionOperations + :ivar partition_key_range_id: PartitionKeyRangeId operations + :vartype partition_key_range_id: azure.mgmt.cosmosdb.v2019_08_01.operations.PartitionKeyRangeIdOperations + :ivar partition_key_range_id_region: PartitionKeyRangeIdRegion operations + :vartype partition_key_range_id_region: azure.mgmt.cosmosdb.v2019_08_01.operations.PartitionKeyRangeIdRegionOperations + :ivar sql_resources: SqlResources operations + :vartype sql_resources: azure.mgmt.cosmosdb.v2019_08_01.operations.SqlResourcesOperations + :ivar mongo_db_resources: MongoDBResources operations + :vartype mongo_db_resources: azure.mgmt.cosmosdb.v2019_08_01.operations.MongoDBResourcesOperations + :ivar table_resources: TableResources operations + :vartype table_resources: azure.mgmt.cosmosdb.v2019_08_01.operations.TableResourcesOperations + :ivar cassandra_resources: CassandraResources operations + :vartype cassandra_resources: azure.mgmt.cosmosdb.v2019_08_01.operations.CassandraResourcesOperations + :ivar gremlin_resources: GremlinResources operations + :vartype gremlin_resources: azure.mgmt.cosmosdb.v2019_08_01.operations.GremlinResourcesOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = CosmosDBConfiguration(credentials, subscription_id, base_url) + super(CosmosDB, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-08-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.database_accounts = DatabaseAccountsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.database = DatabaseOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection = CollectionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection_region = CollectionRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.database_account_region = DatabaseAccountRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.percentile_source_target = PercentileSourceTargetOperations( + self._client, self.config, self._serialize, self._deserialize) + self.percentile_target = PercentileTargetOperations( + self._client, self.config, self._serialize, self._deserialize) + self.percentile = PercentileOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection_partition_region = CollectionPartitionRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection_partition = CollectionPartitionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.partition_key_range_id = PartitionKeyRangeIdOperations( + self._client, self.config, self._serialize, self._deserialize) + self.partition_key_range_id_region = PartitionKeyRangeIdRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.sql_resources = SqlResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.mongo_db_resources = MongoDBResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.table_resources = TableResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.cassandra_resources = CassandraResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.gremlin_resources = GremlinResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/__init__.py new file mode 100644 index 000000000000..2d086b5f8cc7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/__init__.py @@ -0,0 +1,341 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ARMProxyResource + from ._models_py3 import ARMResourceProperties + from ._models_py3 import Capability + from ._models_py3 import CassandraKeyspaceCreateUpdateParameters + from ._models_py3 import CassandraKeyspaceGetResults + from ._models_py3 import CassandraKeyspaceResource + from ._models_py3 import CassandraPartitionKey + from ._models_py3 import CassandraSchema + from ._models_py3 import CassandraTableCreateUpdateParameters + from ._models_py3 import CassandraTableGetResults + from ._models_py3 import CassandraTableResource + from ._models_py3 import ClusterKey + from ._models_py3 import Column + from ._models_py3 import ConflictResolutionPolicy + from ._models_py3 import ConsistencyPolicy + from ._models_py3 import ContainerPartitionKey + from ._models_py3 import DatabaseAccountConnectionString + from ._models_py3 import DatabaseAccountCreateUpdateParameters + from ._models_py3 import DatabaseAccountGetResults + from ._models_py3 import DatabaseAccountListConnectionStringsResult + from ._models_py3 import DatabaseAccountListKeysResult + from ._models_py3 import DatabaseAccountListReadOnlyKeysResult + from ._models_py3 import DatabaseAccountRegenerateKeyParameters + from ._models_py3 import DatabaseAccountUpdateParameters + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ExcludedPath + from ._models_py3 import ExtendedResourceProperties + from ._models_py3 import FailoverPolicies + from ._models_py3 import FailoverPolicy + from ._models_py3 import GremlinDatabaseCreateUpdateParameters + from ._models_py3 import GremlinDatabaseGetResults + from ._models_py3 import GremlinDatabaseResource + from ._models_py3 import GremlinGraphCreateUpdateParameters + from ._models_py3 import GremlinGraphGetResults + from ._models_py3 import GremlinGraphResource + from ._models_py3 import IncludedPath + from ._models_py3 import Indexes + from ._models_py3 import IndexingPolicy + from ._models_py3 import Location + from ._models_py3 import Metric + from ._models_py3 import MetricAvailability + from ._models_py3 import MetricDefinition + from ._models_py3 import MetricName + from ._models_py3 import MetricValue + from ._models_py3 import MongoDBCollectionCreateUpdateParameters + from ._models_py3 import MongoDBCollectionGetResults + from ._models_py3 import MongoDBCollectionResource + from ._models_py3 import MongoDBDatabaseCreateUpdateParameters + from ._models_py3 import MongoDBDatabaseGetResults + from ._models_py3 import MongoDBDatabaseResource + from ._models_py3 import MongoIndex + from ._models_py3 import MongoIndexKeys + from ._models_py3 import MongoIndexOptions + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import PartitionMetric + from ._models_py3 import PartitionUsage + from ._models_py3 import PercentileMetric + from ._models_py3 import PercentileMetricValue + from ._models_py3 import RegionForOnlineOffline + from ._models_py3 import SqlContainerCreateUpdateParameters + from ._models_py3 import SqlContainerGetResults + from ._models_py3 import SqlContainerResource + from ._models_py3 import SqlDatabaseCreateUpdateParameters + from ._models_py3 import SqlDatabaseGetResults + from ._models_py3 import SqlDatabaseResource + from ._models_py3 import SqlStoredProcedureCreateUpdateParameters + from ._models_py3 import SqlStoredProcedureGetResults + from ._models_py3 import SqlStoredProcedureResource + from ._models_py3 import SqlTriggerCreateUpdateParameters + from ._models_py3 import SqlTriggerGetResults + from ._models_py3 import SqlTriggerResource + from ._models_py3 import SqlUserDefinedFunctionCreateUpdateParameters + from ._models_py3 import SqlUserDefinedFunctionGetResults + from ._models_py3 import SqlUserDefinedFunctionResource + from ._models_py3 import TableCreateUpdateParameters + from ._models_py3 import TableGetResults + from ._models_py3 import TableResource + from ._models_py3 import ThroughputSettingsGetResults + from ._models_py3 import ThroughputSettingsResource + from ._models_py3 import ThroughputSettingsUpdateParameters + from ._models_py3 import UniqueKey + from ._models_py3 import UniqueKeyPolicy + from ._models_py3 import Usage + from ._models_py3 import VirtualNetworkRule +except (SyntaxError, ImportError): + from ._models import ARMProxyResource + from ._models import ARMResourceProperties + from ._models import Capability + from ._models import CassandraKeyspaceCreateUpdateParameters + from ._models import CassandraKeyspaceGetResults + from ._models import CassandraKeyspaceResource + from ._models import CassandraPartitionKey + from ._models import CassandraSchema + from ._models import CassandraTableCreateUpdateParameters + from ._models import CassandraTableGetResults + from ._models import CassandraTableResource + from ._models import ClusterKey + from ._models import Column + from ._models import ConflictResolutionPolicy + from ._models import ConsistencyPolicy + from ._models import ContainerPartitionKey + from ._models import DatabaseAccountConnectionString + from ._models import DatabaseAccountCreateUpdateParameters + from ._models import DatabaseAccountGetResults + from ._models import DatabaseAccountListConnectionStringsResult + from ._models import DatabaseAccountListKeysResult + from ._models import DatabaseAccountListReadOnlyKeysResult + from ._models import DatabaseAccountRegenerateKeyParameters + from ._models import DatabaseAccountUpdateParameters + from ._models import ErrorResponse, ErrorResponseException + from ._models import ExcludedPath + from ._models import ExtendedResourceProperties + from ._models import FailoverPolicies + from ._models import FailoverPolicy + from ._models import GremlinDatabaseCreateUpdateParameters + from ._models import GremlinDatabaseGetResults + from ._models import GremlinDatabaseResource + from ._models import GremlinGraphCreateUpdateParameters + from ._models import GremlinGraphGetResults + from ._models import GremlinGraphResource + from ._models import IncludedPath + from ._models import Indexes + from ._models import IndexingPolicy + from ._models import Location + from ._models import Metric + from ._models import MetricAvailability + from ._models import MetricDefinition + from ._models import MetricName + from ._models import MetricValue + from ._models import MongoDBCollectionCreateUpdateParameters + from ._models import MongoDBCollectionGetResults + from ._models import MongoDBCollectionResource + from ._models import MongoDBDatabaseCreateUpdateParameters + from ._models import MongoDBDatabaseGetResults + from ._models import MongoDBDatabaseResource + from ._models import MongoIndex + from ._models import MongoIndexKeys + from ._models import MongoIndexOptions + from ._models import Operation + from ._models import OperationDisplay + from ._models import PartitionMetric + from ._models import PartitionUsage + from ._models import PercentileMetric + from ._models import PercentileMetricValue + from ._models import RegionForOnlineOffline + from ._models import SqlContainerCreateUpdateParameters + from ._models import SqlContainerGetResults + from ._models import SqlContainerResource + from ._models import SqlDatabaseCreateUpdateParameters + from ._models import SqlDatabaseGetResults + from ._models import SqlDatabaseResource + from ._models import SqlStoredProcedureCreateUpdateParameters + from ._models import SqlStoredProcedureGetResults + from ._models import SqlStoredProcedureResource + from ._models import SqlTriggerCreateUpdateParameters + from ._models import SqlTriggerGetResults + from ._models import SqlTriggerResource + from ._models import SqlUserDefinedFunctionCreateUpdateParameters + from ._models import SqlUserDefinedFunctionGetResults + from ._models import SqlUserDefinedFunctionResource + from ._models import TableCreateUpdateParameters + from ._models import TableGetResults + from ._models import TableResource + from ._models import ThroughputSettingsGetResults + from ._models import ThroughputSettingsResource + from ._models import ThroughputSettingsUpdateParameters + from ._models import UniqueKey + from ._models import UniqueKeyPolicy + from ._models import Usage + from ._models import VirtualNetworkRule +from ._paged_models import CassandraKeyspaceGetResultsPaged +from ._paged_models import CassandraTableGetResultsPaged +from ._paged_models import DatabaseAccountGetResultsPaged +from ._paged_models import GremlinDatabaseGetResultsPaged +from ._paged_models import GremlinGraphGetResultsPaged +from ._paged_models import MetricDefinitionPaged +from ._paged_models import MetricPaged +from ._paged_models import MongoDBCollectionGetResultsPaged +from ._paged_models import MongoDBDatabaseGetResultsPaged +from ._paged_models import OperationPaged +from ._paged_models import PartitionMetricPaged +from ._paged_models import PartitionUsagePaged +from ._paged_models import PercentileMetricPaged +from ._paged_models import SqlContainerGetResultsPaged +from ._paged_models import SqlDatabaseGetResultsPaged +from ._paged_models import SqlStoredProcedureGetResultsPaged +from ._paged_models import SqlTriggerGetResultsPaged +from ._paged_models import SqlUserDefinedFunctionGetResultsPaged +from ._paged_models import TableGetResultsPaged +from ._paged_models import UsagePaged +from ._cosmos_db_enums import ( + DatabaseAccountKind, + DatabaseAccountOfferType, + DefaultConsistencyLevel, + ConnectorOffer, + IndexingMode, + DataType, + IndexKind, + PartitionKind, + ConflictResolutionMode, + TriggerType, + TriggerOperation, + KeyKind, + UnitType, + PrimaryAggregationType, +) + +__all__ = [ + 'ARMProxyResource', + 'ARMResourceProperties', + 'Capability', + 'CassandraKeyspaceCreateUpdateParameters', + 'CassandraKeyspaceGetResults', + 'CassandraKeyspaceResource', + 'CassandraPartitionKey', + 'CassandraSchema', + 'CassandraTableCreateUpdateParameters', + 'CassandraTableGetResults', + 'CassandraTableResource', + 'ClusterKey', + 'Column', + 'ConflictResolutionPolicy', + 'ConsistencyPolicy', + 'ContainerPartitionKey', + 'DatabaseAccountConnectionString', + 'DatabaseAccountCreateUpdateParameters', + 'DatabaseAccountGetResults', + 'DatabaseAccountListConnectionStringsResult', + 'DatabaseAccountListKeysResult', + 'DatabaseAccountListReadOnlyKeysResult', + 'DatabaseAccountRegenerateKeyParameters', + 'DatabaseAccountUpdateParameters', + 'ErrorResponse', 'ErrorResponseException', + 'ExcludedPath', + 'ExtendedResourceProperties', + 'FailoverPolicies', + 'FailoverPolicy', + 'GremlinDatabaseCreateUpdateParameters', + 'GremlinDatabaseGetResults', + 'GremlinDatabaseResource', + 'GremlinGraphCreateUpdateParameters', + 'GremlinGraphGetResults', + 'GremlinGraphResource', + 'IncludedPath', + 'Indexes', + 'IndexingPolicy', + 'Location', + 'Metric', + 'MetricAvailability', + 'MetricDefinition', + 'MetricName', + 'MetricValue', + 'MongoDBCollectionCreateUpdateParameters', + 'MongoDBCollectionGetResults', + 'MongoDBCollectionResource', + 'MongoDBDatabaseCreateUpdateParameters', + 'MongoDBDatabaseGetResults', + 'MongoDBDatabaseResource', + 'MongoIndex', + 'MongoIndexKeys', + 'MongoIndexOptions', + 'Operation', + 'OperationDisplay', + 'PartitionMetric', + 'PartitionUsage', + 'PercentileMetric', + 'PercentileMetricValue', + 'RegionForOnlineOffline', + 'SqlContainerCreateUpdateParameters', + 'SqlContainerGetResults', + 'SqlContainerResource', + 'SqlDatabaseCreateUpdateParameters', + 'SqlDatabaseGetResults', + 'SqlDatabaseResource', + 'SqlStoredProcedureCreateUpdateParameters', + 'SqlStoredProcedureGetResults', + 'SqlStoredProcedureResource', + 'SqlTriggerCreateUpdateParameters', + 'SqlTriggerGetResults', + 'SqlTriggerResource', + 'SqlUserDefinedFunctionCreateUpdateParameters', + 'SqlUserDefinedFunctionGetResults', + 'SqlUserDefinedFunctionResource', + 'TableCreateUpdateParameters', + 'TableGetResults', + 'TableResource', + 'ThroughputSettingsGetResults', + 'ThroughputSettingsResource', + 'ThroughputSettingsUpdateParameters', + 'UniqueKey', + 'UniqueKeyPolicy', + 'Usage', + 'VirtualNetworkRule', + 'DatabaseAccountGetResultsPaged', + 'MetricPaged', + 'UsagePaged', + 'MetricDefinitionPaged', + 'OperationPaged', + 'PercentileMetricPaged', + 'PartitionMetricPaged', + 'PartitionUsagePaged', + 'SqlDatabaseGetResultsPaged', + 'SqlContainerGetResultsPaged', + 'SqlStoredProcedureGetResultsPaged', + 'SqlUserDefinedFunctionGetResultsPaged', + 'SqlTriggerGetResultsPaged', + 'MongoDBDatabaseGetResultsPaged', + 'MongoDBCollectionGetResultsPaged', + 'TableGetResultsPaged', + 'CassandraKeyspaceGetResultsPaged', + 'CassandraTableGetResultsPaged', + 'GremlinDatabaseGetResultsPaged', + 'GremlinGraphGetResultsPaged', + 'DatabaseAccountKind', + 'DatabaseAccountOfferType', + 'DefaultConsistencyLevel', + 'ConnectorOffer', + 'IndexingMode', + 'DataType', + 'IndexKind', + 'PartitionKind', + 'ConflictResolutionMode', + 'TriggerType', + 'TriggerOperation', + 'KeyKind', + 'UnitType', + 'PrimaryAggregationType', +] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_cosmos_db_enums.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_cosmos_db_enums.py new file mode 100644 index 000000000000..0386fbe056dc --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_cosmos_db_enums.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class DatabaseAccountKind(str, Enum): + + global_document_db = "GlobalDocumentDB" + mongo_db = "MongoDB" + parse = "Parse" + + +class DatabaseAccountOfferType(str, Enum): + + standard = "Standard" + + +class DefaultConsistencyLevel(str, Enum): + + eventual = "Eventual" + session = "Session" + bounded_staleness = "BoundedStaleness" + strong = "Strong" + consistent_prefix = "ConsistentPrefix" + + +class ConnectorOffer(str, Enum): + + small = "Small" + + +class IndexingMode(str, Enum): + + consistent = "Consistent" + lazy = "Lazy" + none = "None" + + +class DataType(str, Enum): + + string = "String" + number = "Number" + point = "Point" + polygon = "Polygon" + line_string = "LineString" + multi_polygon = "MultiPolygon" + + +class IndexKind(str, Enum): + + hash = "Hash" + range = "Range" + spatial = "Spatial" + + +class PartitionKind(str, Enum): + + hash = "Hash" + range = "Range" + + +class ConflictResolutionMode(str, Enum): + + last_writer_wins = "LastWriterWins" + custom = "Custom" + + +class TriggerType(str, Enum): + + pre = "Pre" + post = "Post" + + +class TriggerOperation(str, Enum): + + all = "All" + create = "Create" + update = "Update" + delete = "Delete" + replace = "Replace" + + +class KeyKind(str, Enum): + + primary = "primary" + secondary = "secondary" + primary_readonly = "primaryReadonly" + secondary_readonly = "secondaryReadonly" + + +class UnitType(str, Enum): + + count = "Count" + bytes = "Bytes" + seconds = "Seconds" + percent = "Percent" + count_per_second = "CountPerSecond" + bytes_per_second = "BytesPerSecond" + milliseconds = "Milliseconds" + + +class PrimaryAggregationType(str, Enum): + + none = "None" + average = "Average" + total = "Total" + minimum = "Minimum" + maximum = "Maximum" + last = "Last" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_models.py new file mode 100644 index 000000000000..cd8e1a022929 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_models.py @@ -0,0 +1,3699 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ARMProxyResource(Model): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ARMProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ARMResourceProperties(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ARMResourceProperties, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class Capability(Model): + """Cosmos DB capability object. + + :param name: Name of the Cosmos DB capability. For example, "name": + "EnableCassandra". Current values also include "EnableTable" and + "EnableGremlin". + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Capability, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Cassandra + keyspace + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraKeyspaceResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class CassandraKeyspaceGetResults(ARMResourceProperties): + """An Azure Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_keyspace_get_results_id: Required. Name of the Cosmos DB + Cassandra keyspace + :type cassandra_keyspace_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_keyspace_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_keyspace_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceGetResults, self).__init__(**kwargs) + self.cassandra_keyspace_get_results_id = kwargs.get('cassandra_keyspace_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + + +class CassandraKeyspaceResource(Model): + """Cosmos DB Cassandra keyspace resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra keyspace + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class CassandraPartitionKey(Model): + """Cosmos DB Cassandra table partition key. + + :param name: Name of the Cosmos DB Cassandra table partition key + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraPartitionKey, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class CassandraSchema(Model): + """Cosmos DB Cassandra table schema. + + :param columns: List of Cassandra table columns. + :type columns: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Column] + :param partition_keys: List of partition key. + :type partition_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraPartitionKey] + :param cluster_keys: List of cluster key. + :type cluster_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.ClusterKey] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'partition_keys': {'key': 'partitionKeys', 'type': '[CassandraPartitionKey]'}, + 'cluster_keys': {'key': 'clusterKeys', 'type': '[ClusterKey]'}, + } + + def __init__(self, **kwargs): + super(CassandraSchema, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + self.partition_keys = kwargs.get('partition_keys', None) + self.cluster_keys = kwargs.get('cluster_keys', None) + + +class CassandraTableCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraTableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class CassandraTableGetResults(ARMResourceProperties): + """An Azure Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_table_get_results_id: Required. Name of the Cosmos DB + Cassandra table + :type cassandra_table_get_results_id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraSchema + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_table_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_table_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'schema': {'key': 'properties.schema', 'type': 'CassandraSchema'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraTableGetResults, self).__init__(**kwargs) + self.cassandra_table_get_results_id = kwargs.get('cassandra_table_get_results_id', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.schema = kwargs.get('schema', None) + self._rid = None + self._ts = None + self._etag = None + + +class CassandraTableResource(Model): + """Cosmos DB Cassandra table resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra table + :type id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraSchema + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, **kwargs): + super(CassandraTableResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.schema = kwargs.get('schema', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ClusterKey(Model): + """Cosmos DB Cassandra table cluster key. + + :param name: Name of the Cosmos DB Cassandra table cluster key + :type name: str + :param order_by: Order of the Cosmos DB Cassandra table cluster key, only + support "Asc" and "Desc" + :type order_by: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'order_by': {'key': 'orderBy', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ClusterKey, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.order_by = kwargs.get('order_by', None) + + +class Column(Model): + """Cosmos DB Cassandra table column. + + :param name: Name of the Cosmos DB Cassandra table column + :type name: str + :param type: Type of the Cosmos DB Cassandra table column + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Column, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class ConflictResolutionPolicy(Model): + """The conflict resolution policy for the container. + + :param mode: Indicates the conflict resolution mode. Possible values + include: 'LastWriterWins', 'Custom'. Default value: "LastWriterWins" . + :type mode: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionMode + :param conflict_resolution_path: The conflict resolution path in the case + of LastWriterWins mode. + :type conflict_resolution_path: str + :param conflict_resolution_procedure: The procedure to resolve conflicts + in the case of custom mode. + :type conflict_resolution_procedure: str + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, + 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ConflictResolutionPolicy, self).__init__(**kwargs) + self.mode = kwargs.get('mode', "LastWriterWins") + self.conflict_resolution_path = kwargs.get('conflict_resolution_path', None) + self.conflict_resolution_procedure = kwargs.get('conflict_resolution_procedure', None) + + +class ConsistencyPolicy(Model): + """The consistency policy for the Cosmos DB database account. + + All required parameters must be populated in order to send to Azure. + + :param default_consistency_level: Required. The default consistency level + and configuration settings of the Cosmos DB account. Possible values + include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', + 'ConsistentPrefix' + :type default_consistency_level: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.DefaultConsistencyLevel + :param max_staleness_prefix: When used with the Bounded Staleness + consistency level, this value represents the number of stale requests + tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_staleness_prefix: long + :param max_interval_in_seconds: When used with the Bounded Staleness + consistency level, this value represents the time amount of staleness (in + seconds) tolerated. Accepted range for this value is 5 - 86400. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_interval_in_seconds: int + """ + + _validation = { + 'default_consistency_level': {'required': True}, + 'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1}, + 'max_interval_in_seconds': {'maximum': 86400, 'minimum': 5}, + } + + _attribute_map = { + 'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'DefaultConsistencyLevel'}, + 'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'}, + 'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ConsistencyPolicy, self).__init__(**kwargs) + self.default_consistency_level = kwargs.get('default_consistency_level', None) + self.max_staleness_prefix = kwargs.get('max_staleness_prefix', None) + self.max_interval_in_seconds = kwargs.get('max_interval_in_seconds', None) + + +class ContainerPartitionKey(Model): + """The configuration of the partition key to be used for partitioning data + into multiple partitions. + + :param paths: List of paths using which data within the container can be + partitioned + :type paths: list[str] + :param kind: Indicates the kind of algorithm used for partitioning. + Possible values include: 'Hash', 'Range'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionKind + :param version: Indicates the version of the partition key definition + :type version: int + """ + + _validation = { + 'version': {'maximum': 2, 'minimum': 1}, + } + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ContainerPartitionKey, self).__init__(**kwargs) + self.paths = kwargs.get('paths', None) + self.kind = kwargs.get('kind', "Hash") + self.version = kwargs.get('version', None) + + +class DatabaseAccountConnectionString(Model): + """Connection string for the Cosmos DB account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar connection_string: Value of the connection string + :vartype connection_string: str + :ivar description: Description of the connection string + :vartype description: str + """ + + _validation = { + 'connection_string': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountConnectionString, self).__init__(**kwargs) + self.connection_string = None + self.description = None + + +class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB database accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountKind + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConsistencyPolicy + :param locations: Required. An array that contains the georeplication + locations enabled for the Cosmos DB account. + :type locations: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :ivar database_account_offer_type: Required. The offer type for the + database. Default value: "Standard" . + :vartype database_account_offer_type: str + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + database_account_offer_type = "Standard" + + def __init__(self, **kwargs): + super(DatabaseAccountCreateUpdateParameters, self).__init__(**kwargs) + self.kind = kwargs.get('kind', "GlobalDocumentDB") + self.consistency_policy = kwargs.get('consistency_policy', None) + self.locations = kwargs.get('locations', None) + self.ip_range_filter = kwargs.get('ip_range_filter', None) + self.is_virtual_network_filter_enabled = kwargs.get('is_virtual_network_filter_enabled', None) + self.enable_automatic_failover = kwargs.get('enable_automatic_failover', None) + self.capabilities = kwargs.get('capabilities', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.enable_multiple_write_locations = kwargs.get('enable_multiple_write_locations', None) + self.enable_cassandra_connector = kwargs.get('enable_cassandra_connector', None) + self.connector_offer = kwargs.get('connector_offer', None) + self.disable_key_based_metadata_write_access = kwargs.get('disable_key_based_metadata_write_access', None) + + +class DatabaseAccountGetResults(ARMResourceProperties): + """An Azure Cosmos DB database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountKind + :param provisioning_state: + :type provisioning_state: str + :ivar document_endpoint: The connection endpoint for the Cosmos DB + database account. + :vartype document_endpoint: str + :ivar database_account_offer_type: The offer type for the Cosmos DB + database account. Default value: Standard. Possible values include: + 'Standard' + :vartype database_account_offer_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountOfferType + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param consistency_policy: The consistency policy for the Cosmos DB + database account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConsistencyPolicy + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Capability] + :ivar write_locations: An array that contains the write location for the + Cosmos DB account. + :vartype write_locations: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :ivar read_locations: An array that contains of the read locations enabled + for the Cosmos DB account. + :vartype read_locations: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :ivar locations: An array that contains all of the locations enabled for + the Cosmos DB account. + :vartype locations: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :ivar failover_policies: An array that contains the regions ordered by + their failover priorities. + :vartype failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.FailoverPolicy] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'database_account_offer_type': {'readonly': True}, + 'write_locations': {'readonly': True}, + 'read_locations': {'readonly': True}, + 'locations': {'readonly': True}, + 'failover_policies': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'DatabaseAccountOfferType'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'}, + 'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountGetResults, self).__init__(**kwargs) + self.kind = kwargs.get('kind', "GlobalDocumentDB") + self.provisioning_state = kwargs.get('provisioning_state', None) + self.document_endpoint = None + self.database_account_offer_type = None + self.ip_range_filter = kwargs.get('ip_range_filter', None) + self.is_virtual_network_filter_enabled = kwargs.get('is_virtual_network_filter_enabled', None) + self.enable_automatic_failover = kwargs.get('enable_automatic_failover', None) + self.consistency_policy = kwargs.get('consistency_policy', None) + self.capabilities = kwargs.get('capabilities', None) + self.write_locations = None + self.read_locations = None + self.locations = None + self.failover_policies = None + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.enable_multiple_write_locations = kwargs.get('enable_multiple_write_locations', None) + self.enable_cassandra_connector = kwargs.get('enable_cassandra_connector', None) + self.connector_offer = kwargs.get('connector_offer', None) + self.disable_key_based_metadata_write_access = kwargs.get('disable_key_based_metadata_write_access', None) + + +class DatabaseAccountListConnectionStringsResult(Model): + """The connection strings for the given database account. + + :param connection_strings: An array that contains the connection strings + for the Cosmos DB account. + :type connection_strings: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountConnectionString] + """ + + _attribute_map = { + 'connection_strings': {'key': 'connectionStrings', 'type': '[DatabaseAccountConnectionString]'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountListConnectionStringsResult, self).__init__(**kwargs) + self.connection_strings = kwargs.get('connection_strings', None) + + +class DatabaseAccountListReadOnlyKeysResult(Model): + """The read-only access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountListReadOnlyKeysResult, self).__init__(**kwargs) + self.primary_readonly_master_key = None + self.secondary_readonly_master_key = None + + +class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): + """The access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + :ivar primary_master_key: Base 64 encoded value of the primary read-write + key. + :vartype primary_master_key: str + :ivar secondary_master_key: Base 64 encoded value of the secondary + read-write key. + :vartype secondary_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + 'primary_master_key': {'readonly': True}, + 'secondary_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + 'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'}, + 'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountListKeysResult, self).__init__(**kwargs) + self.primary_master_key = None + self.secondary_master_key = None + + +class DatabaseAccountRegenerateKeyParameters(Model): + """Parameters to regenerate the keys within the database account. + + All required parameters must be populated in order to send to Azure. + + :param key_kind: Required. The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + :type key_kind: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.KeyKind + """ + + _validation = { + 'key_kind': {'required': True}, + } + + _attribute_map = { + 'key_kind': {'key': 'keyKind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountRegenerateKeyParameters, self).__init__(**kwargs) + self.key_kind = kwargs.get('key_kind', None) + + +class DatabaseAccountUpdateParameters(Model): + """Parameters for patching Azure Cosmos DB database account properties. + + :param tags: + :type tags: dict[str, str] + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConsistencyPolicy + :param locations: An array that contains the georeplication locations + enabled for the Cosmos DB account. + :type locations: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + self.consistency_policy = kwargs.get('consistency_policy', None) + self.locations = kwargs.get('locations', None) + self.ip_range_filter = kwargs.get('ip_range_filter', None) + self.is_virtual_network_filter_enabled = kwargs.get('is_virtual_network_filter_enabled', None) + self.enable_automatic_failover = kwargs.get('enable_automatic_failover', None) + self.capabilities = kwargs.get('capabilities', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.enable_multiple_write_locations = kwargs.get('enable_multiple_write_locations', None) + self.enable_cassandra_connector = kwargs.get('enable_cassandra_connector', None) + self.connector_offer = kwargs.get('connector_offer', None) + self.disable_key_based_metadata_write_access = kwargs.get('disable_key_based_metadata_write_access', None) + + +class ErrorResponse(Model): + """Error Response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ExcludedPath(Model): + """ExcludedPath. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExcludedPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + + +class ExtendedResourceProperties(Model): + """The system generated resource properties associated with SQL databases, SQL + containers, Gremlin databases and Gremlin graphs. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + '_rid': {'key': '_rid', 'type': 'str'}, + '_ts': {'key': '_ts', 'type': 'object'}, + '_etag': {'key': '_etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExtendedResourceProperties, self).__init__(**kwargs) + self._rid = None + self._ts = None + self._etag = None + + +class FailoverPolicies(Model): + """The list of new failover policies for the failover priority change. + + All required parameters must be populated in order to send to Azure. + + :param failover_policies: Required. List of failover policies. + :type failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.FailoverPolicy] + """ + + _validation = { + 'failover_policies': {'required': True}, + } + + _attribute_map = { + 'failover_policies': {'key': 'failoverPolicies', 'type': '[FailoverPolicy]'}, + } + + def __init__(self, **kwargs): + super(FailoverPolicies, self).__init__(**kwargs) + self.failover_policies = kwargs.get('failover_policies', None) + + +class FailoverPolicy(Model): + """The failover policy for a given region of a database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region in which the database + account replicates to. Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region in which the database account + exists. + :type location_name: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + """ + + _validation = { + 'id': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(FailoverPolicy, self).__init__(**kwargs) + self.id = None + self.location_name = kwargs.get('location_name', None) + self.failover_priority = kwargs.get('failover_priority', None) + + +class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class GremlinDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_database_get_results_id: Required. Name of the Cosmos DB + Gremlin database + :type gremlin_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseGetResults, self).__init__(**kwargs) + self.gremlin_database_get_results_id = kwargs.get('gremlin_database_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + + +class GremlinDatabaseResource(Model): + """Cosmos DB Gremlin database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class GremlinGraphCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Gremlin graph + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinGraphResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(GremlinGraphCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class GremlinGraphGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_graph_get_results_id: Required. Name of the Cosmos DB + Gremlin graph + :type gremlin_graph_get_results_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionPolicy + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_graph_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_graph_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinGraphGetResults, self).__init__(**kwargs) + self.gremlin_graph_get_results_id = kwargs.get('gremlin_graph_get_results_id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + self._rid = None + self._ts = None + self._etag = None + + +class GremlinGraphResource(Model): + """Cosmos DB Gremlin graph resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin graph + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, **kwargs): + super(GremlinGraphResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + + +class IncludedPath(Model): + """The paths that are included in indexing. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + :param indexes: List of indexes for this path + :type indexes: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Indexes] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, + } + + def __init__(self, **kwargs): + super(IncludedPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.indexes = kwargs.get('indexes', None) + + +class Indexes(Model): + """The indexes for the path. + + :param data_type: The datatype for which the indexing behavior is applied + to. Possible values include: 'String', 'Number', 'Point', 'Polygon', + 'LineString', 'MultiPolygon'. Default value: "String" . + :type data_type: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.DataType + :param precision: The precision of the index. -1 is maximum precision. + :type precision: int + :param kind: Indicates the type of index. Possible values include: 'Hash', + 'Range', 'Spatial'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexKind + """ + + _attribute_map = { + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'precision': {'key': 'precision', 'type': 'int'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Indexes, self).__init__(**kwargs) + self.data_type = kwargs.get('data_type', "String") + self.precision = kwargs.get('precision', None) + self.kind = kwargs.get('kind', "Hash") + + +class IndexingPolicy(Model): + """Cosmos DB indexing policy. + + :param automatic: Indicates if the indexing policy is automatic + :type automatic: bool + :param indexing_mode: Indicates the indexing mode. Possible values + include: 'Consistent', 'Lazy', 'None'. Default value: "Consistent" . + :type indexing_mode: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingMode + :param included_paths: List of paths to include in the indexing + :type included_paths: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.IncludedPath] + :param excluded_paths: List of paths to exclude from indexing + :type excluded_paths: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.ExcludedPath] + """ + + _attribute_map = { + 'automatic': {'key': 'automatic', 'type': 'bool'}, + 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, + 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, + } + + def __init__(self, **kwargs): + super(IndexingPolicy, self).__init__(**kwargs) + self.automatic = kwargs.get('automatic', None) + self.indexing_mode = kwargs.get('indexing_mode', "Consistent") + self.included_paths = kwargs.get('included_paths', None) + self.excluded_paths = kwargs.get('excluded_paths', None) + + +class Location(Model): + """A region in which the Azure Cosmos DB database account is deployed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region within the database account. + Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region. + :type location_name: str + :ivar document_endpoint: The connection endpoint for the specific region. + Example: + https://<accountName>-<locationName>.documents.azure.com:443/ + :vartype document_endpoint: str + :param provisioning_state: + :type provisioning_state: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + :param is_zone_redundant: Flag to indicate whether or not this region is + an AvailabilityZone region + :type is_zone_redundant: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'document_endpoint': {'key': 'documentEndpoint', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + 'is_zone_redundant': {'key': 'isZoneRedundant', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(Location, self).__init__(**kwargs) + self.id = None + self.location_name = kwargs.get('location_name', None) + self.document_endpoint = None + self.provisioning_state = kwargs.get('provisioning_state', None) + self.failover_priority = kwargs.get('failover_priority', None) + self.is_zone_redundant = kwargs.get('is_zone_redundant', None) + + +class Metric(Model): + """Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.MetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + } + + def __init__(self, **kwargs): + super(Metric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = kwargs.get('unit', None) + self.name = None + self.metric_values = None + + +class MetricAvailability(Model): + """The availability of the metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :ivar retention: The retention for the metric values. + :vartype retention: str + """ + + _validation = { + 'time_grain': {'readonly': True}, + 'retention': {'readonly': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'retention': {'key': 'retention', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = None + self.retention = None + + +class MetricDefinition(Model): + """The definition of a metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar metric_availabilities: The list of metric availabilities for the + account. + :vartype metric_availabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.MetricAvailability] + :ivar primary_aggregation_type: The primary aggregation type of the + metric. Possible values include: 'None', 'Average', 'Total', 'Minimum', + 'Maximum', 'Last' + :vartype primary_aggregation_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.PrimaryAggregationType + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar resource_uri: The resource uri of the database. + :vartype resource_uri: str + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + """ + + _validation = { + 'metric_availabilities': {'readonly': True}, + 'primary_aggregation_type': {'readonly': True}, + 'resource_uri': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + } + + def __init__(self, **kwargs): + super(MetricDefinition, self).__init__(**kwargs) + self.metric_availabilities = None + self.primary_aggregation_type = None + self.unit = kwargs.get('unit', None) + self.resource_uri = None + self.name = None + + +class MetricName(Model): + """A metric name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The name of the metric. + :vartype value: str + :ivar localized_value: The friendly name of the metric. + :vartype localized_value: str + """ + + _validation = { + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricName, self).__init__(**kwargs) + self.value = None + self.localized_value = None + + +class MetricValue(Model): + """Represents metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(MetricValue, self).__init__(**kwargs) + self._count = None + self.average = None + self.maximum = None + self.minimum = None + self.timestamp = None + self.total = None + + +class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a MongoDB + collection + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBCollectionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MongoDBCollectionCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class MongoDBCollectionGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_collection_get_results_id: Required. Name of the Cosmos DB + MongoDB collection + :type mongo_db_collection_get_results_id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoIndex] + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_collection_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_collection_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'shard_key': {'key': 'properties.shardKey', 'type': '{str}'}, + 'indexes': {'key': 'properties.indexes', 'type': '[MongoIndex]'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDBCollectionGetResults, self).__init__(**kwargs) + self.mongo_db_collection_get_results_id = kwargs.get('mongo_db_collection_get_results_id', None) + self.shard_key = kwargs.get('shard_key', None) + self.indexes = kwargs.get('indexes', None) + self._rid = None + self._ts = None + self._etag = None + + +class MongoDBCollectionResource(Model): + """Cosmos DB MongoDB collection resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB collection + :type id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoIndex] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, **kwargs): + super(MongoDBCollectionResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.shard_key = kwargs.get('shard_key', None) + self.indexes = kwargs.get('indexes', None) + + +class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a MongoDB database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MongoDBDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class MongoDBDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_database_get_results_id: Required. Name of the Cosmos DB + MongoDB database + :type mongo_db_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDBDatabaseGetResults, self).__init__(**kwargs) + self.mongo_db_database_get_results_id = kwargs.get('mongo_db_database_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + + +class MongoDBDatabaseResource(Model): + """Cosmos DB MongoDB database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDBDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class MongoIndex(Model): + """Cosmos DB MongoDB collection index key. + + :param key: Cosmos DB MongoDB collection index keys + :type key: ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoIndexKeys + :param options: Cosmos DB MongoDB collection index key options + :type options: ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoIndexOptions + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, + 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, + } + + def __init__(self, **kwargs): + super(MongoIndex, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.options = kwargs.get('options', None) + + +class MongoIndexKeys(Model): + """Cosmos DB MongoDB collection resource object. + + :param keys: List of keys for each MongoDB collection in the Azure Cosmos + DB service + :type keys: list[str] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MongoIndexKeys, self).__init__(**kwargs) + self.keys = kwargs.get('keys', None) + + +class MongoIndexOptions(Model): + """Cosmos DB MongoDB collection index options. + + :param expire_after_seconds: Expire after seconds + :type expire_after_seconds: int + :param unique: Is unique or not + :type unique: bool + """ + + _attribute_map = { + 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, + 'unique': {'key': 'unique', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(MongoIndexOptions, self).__init__(**kwargs) + self.expire_after_seconds = kwargs.get('expire_after_seconds', None) + self.unique = kwargs.get('unique', None) + + +class Operation(Model): + """REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.cosmosdb.v2019_08_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ResourceProvider + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'Provider', 'type': 'str'}, + 'resource': {'key': 'Resource', 'type': 'str'}, + 'operation': {'key': 'Operation', 'type': 'str'}, + 'description': {'key': 'Description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class PartitionMetric(Metric): + """The metric values for a single partition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.MetricValue] + :ivar partition_id: The partition id (GUID identifier) of the metric + values. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the metric values. + :vartype partition_key_range_id: str + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PartitionMetric, self).__init__(**kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class Usage(Model): + """The usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(Usage, self).__init__(**kwargs) + self.unit = kwargs.get('unit', None) + self.name = None + self.quota_period = None + self.limit = None + self.current_value = None + + +class PartitionUsage(Usage): + """The partition level usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + :ivar partition_id: The partition id (GUID identifier) of the usages. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the usages. + :vartype partition_key_range_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PartitionUsage, self).__init__(**kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class PercentileMetric(Model): + """Percentile Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar metric_values: The percentile metric values for the specified time + window and timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.PercentileMetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[PercentileMetricValue]'}, + } + + def __init__(self, **kwargs): + super(PercentileMetric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = kwargs.get('unit', None) + self.name = None + self.metric_values = None + + +class PercentileMetricValue(MetricValue): + """Represents percentile metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + :ivar p10: The 10th percentile value for the metric. + :vartype p10: float + :ivar p25: The 25th percentile value for the metric. + :vartype p25: float + :ivar p50: The 50th percentile value for the metric. + :vartype p50: float + :ivar p75: The 75th percentile value for the metric. + :vartype p75: float + :ivar p90: The 90th percentile value for the metric. + :vartype p90: float + :ivar p95: The 95th percentile value for the metric. + :vartype p95: float + :ivar p99: The 99th percentile value for the metric. + :vartype p99: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + 'p10': {'readonly': True}, + 'p25': {'readonly': True}, + 'p50': {'readonly': True}, + 'p75': {'readonly': True}, + 'p90': {'readonly': True}, + 'p95': {'readonly': True}, + 'p99': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + 'p10': {'key': 'P10', 'type': 'float'}, + 'p25': {'key': 'P25', 'type': 'float'}, + 'p50': {'key': 'P50', 'type': 'float'}, + 'p75': {'key': 'P75', 'type': 'float'}, + 'p90': {'key': 'P90', 'type': 'float'}, + 'p95': {'key': 'P95', 'type': 'float'}, + 'p99': {'key': 'P99', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(PercentileMetricValue, self).__init__(**kwargs) + self.p10 = None + self.p25 = None + self.p50 = None + self.p75 = None + self.p90 = None + self.p95 = None + self.p99 = None + + +class RegionForOnlineOffline(Model): + """Cosmos DB region to online or offline. + + All required parameters must be populated in order to send to Azure. + + :param region: Required. Cosmos DB region, with spaces between words and + each word capitalized. + :type region: str + """ + + _validation = { + 'region': {'required': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegionForOnlineOffline, self).__init__(**kwargs) + self.region = kwargs.get('region', None) + + +class SqlContainerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a container + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlContainerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlContainerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlContainerCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlContainerGetResults(ARMResourceProperties): + """An Azure Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_container_get_results_id: Required. Name of the Cosmos DB SQL + container + :type sql_container_get_results_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionPolicy + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_container_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_container_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlContainerGetResults, self).__init__(**kwargs) + self.sql_container_get_results_id = kwargs.get('sql_container_get_results_id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + self._rid = None + self._ts = None + self._etag = None + + +class SqlContainerResource(Model): + """Cosmos DB SQL container resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL container + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, **kwargs): + super(SqlContainerResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + + +class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a SQL database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_database_get_results_id: Required. Name of the Cosmos DB SQL + database + :type sql_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + :param _colls: A system generated property that specified the addressable + path of the collections resource. + :type _colls: str + :param _users: A system generated property that specifies the addressable + path of the users resource. + :type _users: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + '_colls': {'key': 'properties._colls', 'type': 'str'}, + '_users': {'key': 'properties._users', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseGetResults, self).__init__(**kwargs) + self.sql_database_get_results_id = kwargs.get('sql_database_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + self._colls = kwargs.get('_colls', None) + self._users = kwargs.get('_users', None) + + +class SqlDatabaseResource(Model): + """Cosmos DB SQL database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB storedProcedure. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a storedProcedure + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlStoredProcedureResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlStoredProcedureResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlStoredProcedureCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlStoredProcedureGetResults(ARMResourceProperties): + """An Azure Cosmos DB storedProcedure. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_stored_procedure_get_results_id: Required. Name of the Cosmos + DB SQL storedProcedure + :type sql_stored_procedure_get_results_id: str + :param body: Body of the Stored Procedure + :type body: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_stored_procedure_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_stored_procedure_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlStoredProcedureGetResults, self).__init__(**kwargs) + self.sql_stored_procedure_get_results_id = kwargs.get('sql_stored_procedure_get_results_id', None) + self.body = kwargs.get('body', None) + self._rid = None + self._ts = None + self._etag = None + + +class SqlStoredProcedureResource(Model): + """Cosmos DB SQL storedProcedure resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL storedProcedure + :type id: str + :param body: Body of the Stored Procedure + :type body: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlStoredProcedureResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.body = kwargs.get('body', None) + + +class SqlTriggerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB trigger. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a trigger + :type resource: ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlTriggerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlTriggerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlTriggerCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlTriggerGetResults(ARMResourceProperties): + """An Azure Cosmos DB trigger. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_trigger_get_results_id: Required. Name of the Cosmos DB SQL + trigger + :type sql_trigger_get_results_id: str + :param body: Body of the Trigger + :type body: str + :param trigger_type: Type of the Trigger. Possible values include: 'Pre', + 'Post' + :type trigger_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.TriggerType + :param trigger_operation: The operation the trigger is associated with. + Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' + :type trigger_operation: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.TriggerOperation + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_trigger_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_trigger_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + 'trigger_type': {'key': 'properties.triggerType', 'type': 'str'}, + 'trigger_operation': {'key': 'properties.triggerOperation', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlTriggerGetResults, self).__init__(**kwargs) + self.sql_trigger_get_results_id = kwargs.get('sql_trigger_get_results_id', None) + self.body = kwargs.get('body', None) + self.trigger_type = kwargs.get('trigger_type', None) + self.trigger_operation = kwargs.get('trigger_operation', None) + self._rid = None + self._ts = None + self._etag = None + + +class SqlTriggerResource(Model): + """Cosmos DB SQL trigger resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL trigger + :type id: str + :param body: Body of the Trigger + :type body: str + :param trigger_type: Type of the Trigger. Possible values include: 'Pre', + 'Post' + :type trigger_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.TriggerType + :param trigger_operation: The operation the trigger is associated with. + Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' + :type trigger_operation: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.TriggerOperation + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + 'trigger_type': {'key': 'triggerType', 'type': 'str'}, + 'trigger_operation': {'key': 'triggerOperation', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlTriggerResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.body = kwargs.get('body', None) + self.trigger_type = kwargs.get('trigger_type', None) + self.trigger_operation = kwargs.get('trigger_operation', None) + + +class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB userDefinedFunction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a + userDefinedFunction + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlUserDefinedFunctionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlUserDefinedFunctionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlUserDefinedFunctionCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlUserDefinedFunctionGetResults(ARMResourceProperties): + """An Azure Cosmos DB userDefinedFunction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_user_defined_function_get_results_id: Required. Name of the + Cosmos DB SQL userDefinedFunction + :type sql_user_defined_function_get_results_id: str + :param body: Body of the User Defined Function + :type body: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_user_defined_function_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_user_defined_function_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlUserDefinedFunctionGetResults, self).__init__(**kwargs) + self.sql_user_defined_function_get_results_id = kwargs.get('sql_user_defined_function_get_results_id', None) + self.body = kwargs.get('body', None) + self._rid = None + self._ts = None + self._etag = None + + +class SqlUserDefinedFunctionResource(Model): + """Cosmos DB SQL userDefinedFunction resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL userDefinedFunction + :type id: str + :param body: Body of the User Defined Function + :type body: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlUserDefinedFunctionResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.body = kwargs.get('body', None) + + +class TableCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Table + :type resource: ~azure.mgmt.cosmosdb.v2019_08_01.models.TableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'TableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class TableGetResults(ARMResourceProperties): + """An Azure Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param table_get_results_id: Required. Name of the Cosmos DB table + :type table_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'table_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'table_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TableGetResults, self).__init__(**kwargs) + self.table_get_results_id = kwargs.get('table_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + + +class TableResource(Model): + """Cosmos DB table resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB table + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TableResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class ThroughputSettingsGetResults(ARMResourceProperties): + """An Azure Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + :ivar minimum_throughput: The minimum throughput of the resource + :vartype minimum_throughput: str + :ivar offer_replace_pending: The throughput replace is pending + :vartype offer_replace_pending: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'throughput': {'key': 'properties.throughput', 'type': 'int'}, + 'minimum_throughput': {'key': 'properties.minimumThroughput', 'type': 'str'}, + 'offer_replace_pending': {'key': 'properties.offerReplacePending', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ThroughputSettingsGetResults, self).__init__(**kwargs) + self.throughput = kwargs.get('throughput', None) + self.minimum_throughput = None + self.offer_replace_pending = None + + +class ThroughputSettingsResource(Model): + """Cosmos DB resource throughput object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + :ivar minimum_throughput: The minimum throughput of the resource + :vartype minimum_throughput: str + :ivar offer_replace_pending: The throughput replace is pending + :vartype offer_replace_pending: str + """ + + _validation = { + 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, + } + + _attribute_map = { + 'throughput': {'key': 'throughput', 'type': 'int'}, + 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, + 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ThroughputSettingsResource, self).__init__(**kwargs) + self.throughput = kwargs.get('throughput', None) + self.minimum_throughput = None + self.offer_replace_pending = None + + +class ThroughputSettingsUpdateParameters(ARMResourceProperties): + """Parameters to update Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a resource + throughput + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsResource + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'ThroughputSettingsResource'}, + } + + def __init__(self, **kwargs): + super(ThroughputSettingsUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + + +class UniqueKey(Model): + """The unique key on that enforces uniqueness constraint on documents in the + collection in the Azure Cosmos DB service. + + :param paths: List of paths must be unique for each document in the Azure + Cosmos DB service + :type paths: list[str] + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UniqueKey, self).__init__(**kwargs) + self.paths = kwargs.get('paths', None) + + +class UniqueKeyPolicy(Model): + """The unique key policy configuration for specifying uniqueness constraints + on documents in the collection in the Azure Cosmos DB service. + + :param unique_keys: List of unique keys on that enforces uniqueness + constraint on documents in the collection in the Azure Cosmos DB service. + :type unique_keys: list[~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKey] + """ + + _attribute_map = { + 'unique_keys': {'key': 'uniqueKeys', 'type': '[UniqueKey]'}, + } + + def __init__(self, **kwargs): + super(UniqueKeyPolicy, self).__init__(**kwargs) + self.unique_keys = kwargs.get('unique_keys', None) + + +class VirtualNetworkRule(Model): + """Virtual Network ACL Rule object. + + :param id: Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :type id: str + :param ignore_missing_vnet_service_endpoint: Create firewall rule before + the virtual network has vnet service endpoint enabled. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVNetServiceEndpoint', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_models_py3.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_models_py3.py new file mode 100644 index 000000000000..45d3d7e59eb8 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_models_py3.py @@ -0,0 +1,3699 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ARMProxyResource(Model): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ARMProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ARMResourceProperties(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + super(ARMResourceProperties, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class Capability(Model): + """Cosmos DB capability object. + + :param name: Name of the Cosmos DB capability. For example, "name": + "EnableCassandra". Current values also include "EnableTable" and + "EnableGremlin". + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, **kwargs) -> None: + super(Capability, self).__init__(**kwargs) + self.name = name + + +class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Cassandra + keyspace + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraKeyspaceResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class CassandraKeyspaceGetResults(ARMResourceProperties): + """An Azure Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_keyspace_get_results_id: Required. Name of the Cosmos DB + Cassandra keyspace + :type cassandra_keyspace_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_keyspace_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_keyspace_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, cassandra_keyspace_get_results_id: str, location: str=None, tags=None, **kwargs) -> None: + super(CassandraKeyspaceGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.cassandra_keyspace_get_results_id = cassandra_keyspace_get_results_id + self._rid = None + self._ts = None + self._etag = None + + +class CassandraKeyspaceResource(Model): + """Cosmos DB Cassandra keyspace resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra keyspace + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(CassandraKeyspaceResource, self).__init__(**kwargs) + self.id = id + + +class CassandraPartitionKey(Model): + """Cosmos DB Cassandra table partition key. + + :param name: Name of the Cosmos DB Cassandra table partition key + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, **kwargs) -> None: + super(CassandraPartitionKey, self).__init__(**kwargs) + self.name = name + + +class CassandraSchema(Model): + """Cosmos DB Cassandra table schema. + + :param columns: List of Cassandra table columns. + :type columns: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Column] + :param partition_keys: List of partition key. + :type partition_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraPartitionKey] + :param cluster_keys: List of cluster key. + :type cluster_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.ClusterKey] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'partition_keys': {'key': 'partitionKeys', 'type': '[CassandraPartitionKey]'}, + 'cluster_keys': {'key': 'clusterKeys', 'type': '[ClusterKey]'}, + } + + def __init__(self, *, columns=None, partition_keys=None, cluster_keys=None, **kwargs) -> None: + super(CassandraSchema, self).__init__(**kwargs) + self.columns = columns + self.partition_keys = partition_keys + self.cluster_keys = cluster_keys + + +class CassandraTableCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraTableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(CassandraTableCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class CassandraTableGetResults(ARMResourceProperties): + """An Azure Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_table_get_results_id: Required. Name of the Cosmos DB + Cassandra table + :type cassandra_table_get_results_id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraSchema + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_table_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_table_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'schema': {'key': 'properties.schema', 'type': 'CassandraSchema'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, cassandra_table_get_results_id: str, location: str=None, tags=None, default_ttl: int=None, schema=None, **kwargs) -> None: + super(CassandraTableGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.cassandra_table_get_results_id = cassandra_table_get_results_id + self.default_ttl = default_ttl + self.schema = schema + self._rid = None + self._ts = None + self._etag = None + + +class CassandraTableResource(Model): + """Cosmos DB Cassandra table resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra table + :type id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraSchema + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, *, id: str, default_ttl: int=None, schema=None, **kwargs) -> None: + super(CassandraTableResource, self).__init__(**kwargs) + self.id = id + self.default_ttl = default_ttl + self.schema = schema + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ClusterKey(Model): + """Cosmos DB Cassandra table cluster key. + + :param name: Name of the Cosmos DB Cassandra table cluster key + :type name: str + :param order_by: Order of the Cosmos DB Cassandra table cluster key, only + support "Asc" and "Desc" + :type order_by: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'order_by': {'key': 'orderBy', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, order_by: str=None, **kwargs) -> None: + super(ClusterKey, self).__init__(**kwargs) + self.name = name + self.order_by = order_by + + +class Column(Model): + """Cosmos DB Cassandra table column. + + :param name: Name of the Cosmos DB Cassandra table column + :type name: str + :param type: Type of the Cosmos DB Cassandra table column + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, **kwargs) -> None: + super(Column, self).__init__(**kwargs) + self.name = name + self.type = type + + +class ConflictResolutionPolicy(Model): + """The conflict resolution policy for the container. + + :param mode: Indicates the conflict resolution mode. Possible values + include: 'LastWriterWins', 'Custom'. Default value: "LastWriterWins" . + :type mode: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionMode + :param conflict_resolution_path: The conflict resolution path in the case + of LastWriterWins mode. + :type conflict_resolution_path: str + :param conflict_resolution_procedure: The procedure to resolve conflicts + in the case of custom mode. + :type conflict_resolution_procedure: str + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, + 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, + } + + def __init__(self, *, mode="LastWriterWins", conflict_resolution_path: str=None, conflict_resolution_procedure: str=None, **kwargs) -> None: + super(ConflictResolutionPolicy, self).__init__(**kwargs) + self.mode = mode + self.conflict_resolution_path = conflict_resolution_path + self.conflict_resolution_procedure = conflict_resolution_procedure + + +class ConsistencyPolicy(Model): + """The consistency policy for the Cosmos DB database account. + + All required parameters must be populated in order to send to Azure. + + :param default_consistency_level: Required. The default consistency level + and configuration settings of the Cosmos DB account. Possible values + include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', + 'ConsistentPrefix' + :type default_consistency_level: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.DefaultConsistencyLevel + :param max_staleness_prefix: When used with the Bounded Staleness + consistency level, this value represents the number of stale requests + tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_staleness_prefix: long + :param max_interval_in_seconds: When used with the Bounded Staleness + consistency level, this value represents the time amount of staleness (in + seconds) tolerated. Accepted range for this value is 5 - 86400. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_interval_in_seconds: int + """ + + _validation = { + 'default_consistency_level': {'required': True}, + 'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1}, + 'max_interval_in_seconds': {'maximum': 86400, 'minimum': 5}, + } + + _attribute_map = { + 'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'DefaultConsistencyLevel'}, + 'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'}, + 'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'}, + } + + def __init__(self, *, default_consistency_level, max_staleness_prefix: int=None, max_interval_in_seconds: int=None, **kwargs) -> None: + super(ConsistencyPolicy, self).__init__(**kwargs) + self.default_consistency_level = default_consistency_level + self.max_staleness_prefix = max_staleness_prefix + self.max_interval_in_seconds = max_interval_in_seconds + + +class ContainerPartitionKey(Model): + """The configuration of the partition key to be used for partitioning data + into multiple partitions. + + :param paths: List of paths using which data within the container can be + partitioned + :type paths: list[str] + :param kind: Indicates the kind of algorithm used for partitioning. + Possible values include: 'Hash', 'Range'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionKind + :param version: Indicates the version of the partition key definition + :type version: int + """ + + _validation = { + 'version': {'maximum': 2, 'minimum': 1}, + } + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'int'}, + } + + def __init__(self, *, paths=None, kind="Hash", version: int=None, **kwargs) -> None: + super(ContainerPartitionKey, self).__init__(**kwargs) + self.paths = paths + self.kind = kind + self.version = version + + +class DatabaseAccountConnectionString(Model): + """Connection string for the Cosmos DB account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar connection_string: Value of the connection string + :vartype connection_string: str + :ivar description: Description of the connection string + :vartype description: str + """ + + _validation = { + 'connection_string': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DatabaseAccountConnectionString, self).__init__(**kwargs) + self.connection_string = None + self.description = None + + +class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB database accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountKind + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConsistencyPolicy + :param locations: Required. An array that contains the georeplication + locations enabled for the Cosmos DB account. + :type locations: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :ivar database_account_offer_type: Required. The offer type for the + database. Default value: "Standard" . + :vartype database_account_offer_type: str + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + database_account_offer_type = "Standard" + + def __init__(self, *, locations, location: str=None, tags=None, kind="GlobalDocumentDB", consistency_policy=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, enable_cassandra_connector: bool=None, connector_offer=None, disable_key_based_metadata_write_access: bool=None, **kwargs) -> None: + super(DatabaseAccountCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.consistency_policy = consistency_policy + self.locations = locations + self.ip_range_filter = ip_range_filter + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.capabilities = capabilities + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access + + +class DatabaseAccountGetResults(ARMResourceProperties): + """An Azure Cosmos DB database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountKind + :param provisioning_state: + :type provisioning_state: str + :ivar document_endpoint: The connection endpoint for the Cosmos DB + database account. + :vartype document_endpoint: str + :ivar database_account_offer_type: The offer type for the Cosmos DB + database account. Default value: Standard. Possible values include: + 'Standard' + :vartype database_account_offer_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountOfferType + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param consistency_policy: The consistency policy for the Cosmos DB + database account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConsistencyPolicy + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Capability] + :ivar write_locations: An array that contains the write location for the + Cosmos DB account. + :vartype write_locations: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :ivar read_locations: An array that contains of the read locations enabled + for the Cosmos DB account. + :vartype read_locations: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :ivar locations: An array that contains all of the locations enabled for + the Cosmos DB account. + :vartype locations: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :ivar failover_policies: An array that contains the regions ordered by + their failover priorities. + :vartype failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.FailoverPolicy] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'database_account_offer_type': {'readonly': True}, + 'write_locations': {'readonly': True}, + 'read_locations': {'readonly': True}, + 'locations': {'readonly': True}, + 'failover_policies': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'DatabaseAccountOfferType'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'}, + 'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + def __init__(self, *, location: str=None, tags=None, kind="GlobalDocumentDB", provisioning_state: str=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, consistency_policy=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, enable_cassandra_connector: bool=None, connector_offer=None, disable_key_based_metadata_write_access: bool=None, **kwargs) -> None: + super(DatabaseAccountGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.provisioning_state = provisioning_state + self.document_endpoint = None + self.database_account_offer_type = None + self.ip_range_filter = ip_range_filter + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.consistency_policy = consistency_policy + self.capabilities = capabilities + self.write_locations = None + self.read_locations = None + self.locations = None + self.failover_policies = None + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access + + +class DatabaseAccountListConnectionStringsResult(Model): + """The connection strings for the given database account. + + :param connection_strings: An array that contains the connection strings + for the Cosmos DB account. + :type connection_strings: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountConnectionString] + """ + + _attribute_map = { + 'connection_strings': {'key': 'connectionStrings', 'type': '[DatabaseAccountConnectionString]'}, + } + + def __init__(self, *, connection_strings=None, **kwargs) -> None: + super(DatabaseAccountListConnectionStringsResult, self).__init__(**kwargs) + self.connection_strings = connection_strings + + +class DatabaseAccountListReadOnlyKeysResult(Model): + """The read-only access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DatabaseAccountListReadOnlyKeysResult, self).__init__(**kwargs) + self.primary_readonly_master_key = None + self.secondary_readonly_master_key = None + + +class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): + """The access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + :ivar primary_master_key: Base 64 encoded value of the primary read-write + key. + :vartype primary_master_key: str + :ivar secondary_master_key: Base 64 encoded value of the secondary + read-write key. + :vartype secondary_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + 'primary_master_key': {'readonly': True}, + 'secondary_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + 'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'}, + 'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DatabaseAccountListKeysResult, self).__init__(**kwargs) + self.primary_master_key = None + self.secondary_master_key = None + + +class DatabaseAccountRegenerateKeyParameters(Model): + """Parameters to regenerate the keys within the database account. + + All required parameters must be populated in order to send to Azure. + + :param key_kind: Required. The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + :type key_kind: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.KeyKind + """ + + _validation = { + 'key_kind': {'required': True}, + } + + _attribute_map = { + 'key_kind': {'key': 'keyKind', 'type': 'str'}, + } + + def __init__(self, *, key_kind, **kwargs) -> None: + super(DatabaseAccountRegenerateKeyParameters, self).__init__(**kwargs) + self.key_kind = key_kind + + +class DatabaseAccountUpdateParameters(Model): + """Parameters for patching Azure Cosmos DB database account properties. + + :param tags: + :type tags: dict[str, str] + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConsistencyPolicy + :param locations: An array that contains the georeplication locations + enabled for the Cosmos DB account. + :type locations: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Location] + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + def __init__(self, *, tags=None, location: str=None, consistency_policy=None, locations=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, enable_cassandra_connector: bool=None, connector_offer=None, disable_key_based_metadata_write_access: bool=None, **kwargs) -> None: + super(DatabaseAccountUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.location = location + self.consistency_policy = consistency_policy + self.locations = locations + self.ip_range_filter = ip_range_filter + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.capabilities = capabilities + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access + + +class ErrorResponse(Model): + """Error Response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ExcludedPath(Model): + """ExcludedPath. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__(self, *, path: str=None, **kwargs) -> None: + super(ExcludedPath, self).__init__(**kwargs) + self.path = path + + +class ExtendedResourceProperties(Model): + """The system generated resource properties associated with SQL databases, SQL + containers, Gremlin databases and Gremlin graphs. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + '_rid': {'key': '_rid', 'type': 'str'}, + '_ts': {'key': '_ts', 'type': 'object'}, + '_etag': {'key': '_etag', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ExtendedResourceProperties, self).__init__(**kwargs) + self._rid = None + self._ts = None + self._etag = None + + +class FailoverPolicies(Model): + """The list of new failover policies for the failover priority change. + + All required parameters must be populated in order to send to Azure. + + :param failover_policies: Required. List of failover policies. + :type failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.FailoverPolicy] + """ + + _validation = { + 'failover_policies': {'required': True}, + } + + _attribute_map = { + 'failover_policies': {'key': 'failoverPolicies', 'type': '[FailoverPolicy]'}, + } + + def __init__(self, *, failover_policies, **kwargs) -> None: + super(FailoverPolicies, self).__init__(**kwargs) + self.failover_policies = failover_policies + + +class FailoverPolicy(Model): + """The failover policy for a given region of a database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region in which the database + account replicates to. Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region in which the database account + exists. + :type location_name: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + """ + + _validation = { + 'id': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + } + + def __init__(self, *, location_name: str=None, failover_priority: int=None, **kwargs) -> None: + super(FailoverPolicy, self).__init__(**kwargs) + self.id = None + self.location_name = location_name + self.failover_priority = failover_priority + + +class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(GremlinDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class GremlinDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_database_get_results_id: Required. Name of the Cosmos DB + Gremlin database + :type gremlin_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, gremlin_database_get_results_id: str, location: str=None, tags=None, **kwargs) -> None: + super(GremlinDatabaseGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.gremlin_database_get_results_id = gremlin_database_get_results_id + self._rid = None + self._ts = None + self._etag = None + + +class GremlinDatabaseResource(Model): + """Cosmos DB Gremlin database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(GremlinDatabaseResource, self).__init__(**kwargs) + self.id = id + + +class GremlinGraphCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Gremlin graph + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinGraphResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(GremlinGraphCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class GremlinGraphGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_graph_get_results_id: Required. Name of the Cosmos DB + Gremlin graph + :type gremlin_graph_get_results_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionPolicy + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_graph_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_graph_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, gremlin_graph_get_results_id: str, location: str=None, tags=None, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(GremlinGraphGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.gremlin_graph_get_results_id = gremlin_graph_get_results_id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + self._rid = None + self._ts = None + self._etag = None + + +class GremlinGraphResource(Model): + """Cosmos DB Gremlin graph resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin graph + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, *, id: str, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(GremlinGraphResource, self).__init__(**kwargs) + self.id = id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + + +class IncludedPath(Model): + """The paths that are included in indexing. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + :param indexes: List of indexes for this path + :type indexes: list[~azure.mgmt.cosmosdb.v2019_08_01.models.Indexes] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, + } + + def __init__(self, *, path: str=None, indexes=None, **kwargs) -> None: + super(IncludedPath, self).__init__(**kwargs) + self.path = path + self.indexes = indexes + + +class Indexes(Model): + """The indexes for the path. + + :param data_type: The datatype for which the indexing behavior is applied + to. Possible values include: 'String', 'Number', 'Point', 'Polygon', + 'LineString', 'MultiPolygon'. Default value: "String" . + :type data_type: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.DataType + :param precision: The precision of the index. -1 is maximum precision. + :type precision: int + :param kind: Indicates the type of index. Possible values include: 'Hash', + 'Range', 'Spatial'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexKind + """ + + _attribute_map = { + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'precision': {'key': 'precision', 'type': 'int'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, data_type="String", precision: int=None, kind="Hash", **kwargs) -> None: + super(Indexes, self).__init__(**kwargs) + self.data_type = data_type + self.precision = precision + self.kind = kind + + +class IndexingPolicy(Model): + """Cosmos DB indexing policy. + + :param automatic: Indicates if the indexing policy is automatic + :type automatic: bool + :param indexing_mode: Indicates the indexing mode. Possible values + include: 'Consistent', 'Lazy', 'None'. Default value: "Consistent" . + :type indexing_mode: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingMode + :param included_paths: List of paths to include in the indexing + :type included_paths: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.IncludedPath] + :param excluded_paths: List of paths to exclude from indexing + :type excluded_paths: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.ExcludedPath] + """ + + _attribute_map = { + 'automatic': {'key': 'automatic', 'type': 'bool'}, + 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, + 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, + } + + def __init__(self, *, automatic: bool=None, indexing_mode="Consistent", included_paths=None, excluded_paths=None, **kwargs) -> None: + super(IndexingPolicy, self).__init__(**kwargs) + self.automatic = automatic + self.indexing_mode = indexing_mode + self.included_paths = included_paths + self.excluded_paths = excluded_paths + + +class Location(Model): + """A region in which the Azure Cosmos DB database account is deployed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region within the database account. + Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region. + :type location_name: str + :ivar document_endpoint: The connection endpoint for the specific region. + Example: + https://<accountName>-<locationName>.documents.azure.com:443/ + :vartype document_endpoint: str + :param provisioning_state: + :type provisioning_state: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + :param is_zone_redundant: Flag to indicate whether or not this region is + an AvailabilityZone region + :type is_zone_redundant: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'document_endpoint': {'key': 'documentEndpoint', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + 'is_zone_redundant': {'key': 'isZoneRedundant', 'type': 'bool'}, + } + + def __init__(self, *, location_name: str=None, provisioning_state: str=None, failover_priority: int=None, is_zone_redundant: bool=None, **kwargs) -> None: + super(Location, self).__init__(**kwargs) + self.id = None + self.location_name = location_name + self.document_endpoint = None + self.provisioning_state = provisioning_state + self.failover_priority = failover_priority + self.is_zone_redundant = is_zone_redundant + + +class Metric(Model): + """Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.MetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(Metric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = unit + self.name = None + self.metric_values = None + + +class MetricAvailability(Model): + """The availability of the metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :ivar retention: The retention for the metric values. + :vartype retention: str + """ + + _validation = { + 'time_grain': {'readonly': True}, + 'retention': {'readonly': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'retention': {'key': 'retention', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = None + self.retention = None + + +class MetricDefinition(Model): + """The definition of a metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar metric_availabilities: The list of metric availabilities for the + account. + :vartype metric_availabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.MetricAvailability] + :ivar primary_aggregation_type: The primary aggregation type of the + metric. Possible values include: 'None', 'Average', 'Total', 'Minimum', + 'Maximum', 'Last' + :vartype primary_aggregation_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.PrimaryAggregationType + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar resource_uri: The resource uri of the database. + :vartype resource_uri: str + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + """ + + _validation = { + 'metric_availabilities': {'readonly': True}, + 'primary_aggregation_type': {'readonly': True}, + 'resource_uri': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(MetricDefinition, self).__init__(**kwargs) + self.metric_availabilities = None + self.primary_aggregation_type = None + self.unit = unit + self.resource_uri = None + self.name = None + + +class MetricName(Model): + """A metric name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The name of the metric. + :vartype value: str + :ivar localized_value: The friendly name of the metric. + :vartype localized_value: str + """ + + _validation = { + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(MetricName, self).__init__(**kwargs) + self.value = None + self.localized_value = None + + +class MetricValue(Model): + """Represents metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + } + + def __init__(self, **kwargs) -> None: + super(MetricValue, self).__init__(**kwargs) + self._count = None + self.average = None + self.maximum = None + self.minimum = None + self.timestamp = None + self.total = None + + +class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a MongoDB + collection + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBCollectionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(MongoDBCollectionCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class MongoDBCollectionGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_collection_get_results_id: Required. Name of the Cosmos DB + MongoDB collection + :type mongo_db_collection_get_results_id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoIndex] + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_collection_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_collection_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'shard_key': {'key': 'properties.shardKey', 'type': '{str}'}, + 'indexes': {'key': 'properties.indexes', 'type': '[MongoIndex]'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, mongo_db_collection_get_results_id: str, location: str=None, tags=None, shard_key=None, indexes=None, **kwargs) -> None: + super(MongoDBCollectionGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.mongo_db_collection_get_results_id = mongo_db_collection_get_results_id + self.shard_key = shard_key + self.indexes = indexes + self._rid = None + self._ts = None + self._etag = None + + +class MongoDBCollectionResource(Model): + """Cosmos DB MongoDB collection resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB collection + :type id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoIndex] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, *, id: str, shard_key=None, indexes=None, **kwargs) -> None: + super(MongoDBCollectionResource, self).__init__(**kwargs) + self.id = id + self.shard_key = shard_key + self.indexes = indexes + + +class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a MongoDB database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(MongoDBDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class MongoDBDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_database_get_results_id: Required. Name of the Cosmos DB + MongoDB database + :type mongo_db_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, mongo_db_database_get_results_id: str, location: str=None, tags=None, **kwargs) -> None: + super(MongoDBDatabaseGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.mongo_db_database_get_results_id = mongo_db_database_get_results_id + self._rid = None + self._ts = None + self._etag = None + + +class MongoDBDatabaseResource(Model): + """Cosmos DB MongoDB database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(MongoDBDatabaseResource, self).__init__(**kwargs) + self.id = id + + +class MongoIndex(Model): + """Cosmos DB MongoDB collection index key. + + :param key: Cosmos DB MongoDB collection index keys + :type key: ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoIndexKeys + :param options: Cosmos DB MongoDB collection index key options + :type options: ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoIndexOptions + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, + 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, + } + + def __init__(self, *, key=None, options=None, **kwargs) -> None: + super(MongoIndex, self).__init__(**kwargs) + self.key = key + self.options = options + + +class MongoIndexKeys(Model): + """Cosmos DB MongoDB collection resource object. + + :param keys: List of keys for each MongoDB collection in the Azure Cosmos + DB service + :type keys: list[str] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + } + + def __init__(self, *, keys=None, **kwargs) -> None: + super(MongoIndexKeys, self).__init__(**kwargs) + self.keys = keys + + +class MongoIndexOptions(Model): + """Cosmos DB MongoDB collection index options. + + :param expire_after_seconds: Expire after seconds + :type expire_after_seconds: int + :param unique: Is unique or not + :type unique: bool + """ + + _attribute_map = { + 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, + 'unique': {'key': 'unique', 'type': 'bool'}, + } + + def __init__(self, *, expire_after_seconds: int=None, unique: bool=None, **kwargs) -> None: + super(MongoIndexOptions, self).__init__(**kwargs) + self.expire_after_seconds = expire_after_seconds + self.unique = unique + + +class Operation(Model): + """REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.cosmosdb.v2019_08_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ResourceProvider + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'Provider', 'type': 'str'}, + 'resource': {'key': 'Resource', 'type': 'str'}, + 'operation': {'key': 'Operation', 'type': 'str'}, + 'description': {'key': 'Description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class PartitionMetric(Metric): + """The metric values for a single partition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.MetricValue] + :ivar partition_id: The partition id (GUID identifier) of the metric + values. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the metric values. + :vartype partition_key_range_id: str + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(PartitionMetric, self).__init__(unit=unit, **kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class Usage(Model): + """The usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(Usage, self).__init__(**kwargs) + self.unit = unit + self.name = None + self.quota_period = None + self.limit = None + self.current_value = None + + +class PartitionUsage(Usage): + """The partition level usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + :ivar partition_id: The partition id (GUID identifier) of the usages. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the usages. + :vartype partition_key_range_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(PartitionUsage, self).__init__(unit=unit, **kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class PercentileMetric(Model): + """Percentile Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricName + :ivar metric_values: The percentile metric values for the specified time + window and timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.PercentileMetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[PercentileMetricValue]'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(PercentileMetric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = unit + self.name = None + self.metric_values = None + + +class PercentileMetricValue(MetricValue): + """Represents percentile metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + :ivar p10: The 10th percentile value for the metric. + :vartype p10: float + :ivar p25: The 25th percentile value for the metric. + :vartype p25: float + :ivar p50: The 50th percentile value for the metric. + :vartype p50: float + :ivar p75: The 75th percentile value for the metric. + :vartype p75: float + :ivar p90: The 90th percentile value for the metric. + :vartype p90: float + :ivar p95: The 95th percentile value for the metric. + :vartype p95: float + :ivar p99: The 99th percentile value for the metric. + :vartype p99: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + 'p10': {'readonly': True}, + 'p25': {'readonly': True}, + 'p50': {'readonly': True}, + 'p75': {'readonly': True}, + 'p90': {'readonly': True}, + 'p95': {'readonly': True}, + 'p99': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + 'p10': {'key': 'P10', 'type': 'float'}, + 'p25': {'key': 'P25', 'type': 'float'}, + 'p50': {'key': 'P50', 'type': 'float'}, + 'p75': {'key': 'P75', 'type': 'float'}, + 'p90': {'key': 'P90', 'type': 'float'}, + 'p95': {'key': 'P95', 'type': 'float'}, + 'p99': {'key': 'P99', 'type': 'float'}, + } + + def __init__(self, **kwargs) -> None: + super(PercentileMetricValue, self).__init__(**kwargs) + self.p10 = None + self.p25 = None + self.p50 = None + self.p75 = None + self.p90 = None + self.p95 = None + self.p99 = None + + +class RegionForOnlineOffline(Model): + """Cosmos DB region to online or offline. + + All required parameters must be populated in order to send to Azure. + + :param region: Required. Cosmos DB region, with spaces between words and + each word capitalized. + :type region: str + """ + + _validation = { + 'region': {'required': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, *, region: str, **kwargs) -> None: + super(RegionForOnlineOffline, self).__init__(**kwargs) + self.region = region + + +class SqlContainerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a container + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlContainerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlContainerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlContainerCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlContainerGetResults(ARMResourceProperties): + """An Azure Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_container_get_results_id: Required. Name of the Cosmos DB SQL + container + :type sql_container_get_results_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionPolicy + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_container_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_container_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, sql_container_get_results_id: str, location: str=None, tags=None, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(SqlContainerGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_container_get_results_id = sql_container_get_results_id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + self._rid = None + self._ts = None + self._etag = None + + +class SqlContainerResource(Model): + """Cosmos DB SQL container resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL container + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, *, id: str, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(SqlContainerResource, self).__init__(**kwargs) + self.id = id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + + +class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a SQL database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_database_get_results_id: Required. Name of the Cosmos DB SQL + database + :type sql_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + :param _colls: A system generated property that specified the addressable + path of the collections resource. + :type _colls: str + :param _users: A system generated property that specifies the addressable + path of the users resource. + :type _users: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + '_colls': {'key': 'properties._colls', 'type': 'str'}, + '_users': {'key': 'properties._users', 'type': 'str'}, + } + + def __init__(self, *, sql_database_get_results_id: str, location: str=None, tags=None, _colls: str=None, _users: str=None, **kwargs) -> None: + super(SqlDatabaseGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_database_get_results_id = sql_database_get_results_id + self._rid = None + self._ts = None + self._etag = None + self._colls = _colls + self._users = _users + + +class SqlDatabaseResource(Model): + """Cosmos DB SQL database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(SqlDatabaseResource, self).__init__(**kwargs) + self.id = id + + +class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB storedProcedure. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a storedProcedure + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlStoredProcedureResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlStoredProcedureResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlStoredProcedureCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlStoredProcedureGetResults(ARMResourceProperties): + """An Azure Cosmos DB storedProcedure. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_stored_procedure_get_results_id: Required. Name of the Cosmos + DB SQL storedProcedure + :type sql_stored_procedure_get_results_id: str + :param body: Body of the Stored Procedure + :type body: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_stored_procedure_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_stored_procedure_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, sql_stored_procedure_get_results_id: str, location: str=None, tags=None, body: str=None, **kwargs) -> None: + super(SqlStoredProcedureGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_stored_procedure_get_results_id = sql_stored_procedure_get_results_id + self.body = body + self._rid = None + self._ts = None + self._etag = None + + +class SqlStoredProcedureResource(Model): + """Cosmos DB SQL storedProcedure resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL storedProcedure + :type id: str + :param body: Body of the Stored Procedure + :type body: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + } + + def __init__(self, *, id: str, body: str=None, **kwargs) -> None: + super(SqlStoredProcedureResource, self).__init__(**kwargs) + self.id = id + self.body = body + + +class SqlTriggerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB trigger. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a trigger + :type resource: ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlTriggerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlTriggerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlTriggerCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlTriggerGetResults(ARMResourceProperties): + """An Azure Cosmos DB trigger. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_trigger_get_results_id: Required. Name of the Cosmos DB SQL + trigger + :type sql_trigger_get_results_id: str + :param body: Body of the Trigger + :type body: str + :param trigger_type: Type of the Trigger. Possible values include: 'Pre', + 'Post' + :type trigger_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.TriggerType + :param trigger_operation: The operation the trigger is associated with. + Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' + :type trigger_operation: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.TriggerOperation + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_trigger_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_trigger_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + 'trigger_type': {'key': 'properties.triggerType', 'type': 'str'}, + 'trigger_operation': {'key': 'properties.triggerOperation', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, sql_trigger_get_results_id: str, location: str=None, tags=None, body: str=None, trigger_type=None, trigger_operation=None, **kwargs) -> None: + super(SqlTriggerGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_trigger_get_results_id = sql_trigger_get_results_id + self.body = body + self.trigger_type = trigger_type + self.trigger_operation = trigger_operation + self._rid = None + self._ts = None + self._etag = None + + +class SqlTriggerResource(Model): + """Cosmos DB SQL trigger resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL trigger + :type id: str + :param body: Body of the Trigger + :type body: str + :param trigger_type: Type of the Trigger. Possible values include: 'Pre', + 'Post' + :type trigger_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.TriggerType + :param trigger_operation: The operation the trigger is associated with. + Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' + :type trigger_operation: str or + ~azure.mgmt.cosmosdb.v2019_08_01.models.TriggerOperation + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + 'trigger_type': {'key': 'triggerType', 'type': 'str'}, + 'trigger_operation': {'key': 'triggerOperation', 'type': 'str'}, + } + + def __init__(self, *, id: str, body: str=None, trigger_type=None, trigger_operation=None, **kwargs) -> None: + super(SqlTriggerResource, self).__init__(**kwargs) + self.id = id + self.body = body + self.trigger_type = trigger_type + self.trigger_operation = trigger_operation + + +class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB userDefinedFunction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a + userDefinedFunction + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlUserDefinedFunctionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlUserDefinedFunctionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlUserDefinedFunctionCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlUserDefinedFunctionGetResults(ARMResourceProperties): + """An Azure Cosmos DB userDefinedFunction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_user_defined_function_get_results_id: Required. Name of the + Cosmos DB SQL userDefinedFunction + :type sql_user_defined_function_get_results_id: str + :param body: Body of the User Defined Function + :type body: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_user_defined_function_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_user_defined_function_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, sql_user_defined_function_get_results_id: str, location: str=None, tags=None, body: str=None, **kwargs) -> None: + super(SqlUserDefinedFunctionGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_user_defined_function_get_results_id = sql_user_defined_function_get_results_id + self.body = body + self._rid = None + self._ts = None + self._etag = None + + +class SqlUserDefinedFunctionResource(Model): + """Cosmos DB SQL userDefinedFunction resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL userDefinedFunction + :type id: str + :param body: Body of the User Defined Function + :type body: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + } + + def __init__(self, *, id: str, body: str=None, **kwargs) -> None: + super(SqlUserDefinedFunctionResource, self).__init__(**kwargs) + self.id = id + self.body = body + + +class TableCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Table + :type resource: ~azure.mgmt.cosmosdb.v2019_08_01.models.TableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'TableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(TableCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class TableGetResults(ARMResourceProperties): + """An Azure Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param table_get_results_id: Required. Name of the Cosmos DB table + :type table_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'table_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'table_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, table_get_results_id: str, location: str=None, tags=None, **kwargs) -> None: + super(TableGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.table_get_results_id = table_get_results_id + self._rid = None + self._ts = None + self._etag = None + + +class TableResource(Model): + """Cosmos DB table resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB table + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(TableResource, self).__init__(**kwargs) + self.id = id + + +class ThroughputSettingsGetResults(ARMResourceProperties): + """An Azure Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + :ivar minimum_throughput: The minimum throughput of the resource + :vartype minimum_throughput: str + :ivar offer_replace_pending: The throughput replace is pending + :vartype offer_replace_pending: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'throughput': {'key': 'properties.throughput', 'type': 'int'}, + 'minimum_throughput': {'key': 'properties.minimumThroughput', 'type': 'str'}, + 'offer_replace_pending': {'key': 'properties.offerReplacePending', 'type': 'str'}, + } + + def __init__(self, *, throughput: int, location: str=None, tags=None, **kwargs) -> None: + super(ThroughputSettingsGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.throughput = throughput + self.minimum_throughput = None + self.offer_replace_pending = None + + +class ThroughputSettingsResource(Model): + """Cosmos DB resource throughput object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + :ivar minimum_throughput: The minimum throughput of the resource + :vartype minimum_throughput: str + :ivar offer_replace_pending: The throughput replace is pending + :vartype offer_replace_pending: str + """ + + _validation = { + 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, + } + + _attribute_map = { + 'throughput': {'key': 'throughput', 'type': 'int'}, + 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, + 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, + } + + def __init__(self, *, throughput: int, **kwargs) -> None: + super(ThroughputSettingsResource, self).__init__(**kwargs) + self.throughput = throughput + self.minimum_throughput = None + self.offer_replace_pending = None + + +class ThroughputSettingsUpdateParameters(ARMResourceProperties): + """Parameters to update Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a resource + throughput + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsResource + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'ThroughputSettingsResource'}, + } + + def __init__(self, *, resource, location: str=None, tags=None, **kwargs) -> None: + super(ThroughputSettingsUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + + +class UniqueKey(Model): + """The unique key on that enforces uniqueness constraint on documents in the + collection in the Azure Cosmos DB service. + + :param paths: List of paths must be unique for each document in the Azure + Cosmos DB service + :type paths: list[str] + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + } + + def __init__(self, *, paths=None, **kwargs) -> None: + super(UniqueKey, self).__init__(**kwargs) + self.paths = paths + + +class UniqueKeyPolicy(Model): + """The unique key policy configuration for specifying uniqueness constraints + on documents in the collection in the Azure Cosmos DB service. + + :param unique_keys: List of unique keys on that enforces uniqueness + constraint on documents in the collection in the Azure Cosmos DB service. + :type unique_keys: list[~azure.mgmt.cosmosdb.v2019_08_01.models.UniqueKey] + """ + + _attribute_map = { + 'unique_keys': {'key': 'uniqueKeys', 'type': '[UniqueKey]'}, + } + + def __init__(self, *, unique_keys=None, **kwargs) -> None: + super(UniqueKeyPolicy, self).__init__(**kwargs) + self.unique_keys = unique_keys + + +class VirtualNetworkRule(Model): + """Virtual Network ACL Rule object. + + :param id: Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :type id: str + :param ignore_missing_vnet_service_endpoint: Create firewall rule before + the virtual network has vnet service endpoint enabled. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVNetServiceEndpoint', 'type': 'bool'}, + } + + def __init__(self, *, id: str=None, ignore_missing_vnet_service_endpoint: bool=None, **kwargs) -> None: + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = id + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_paged_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_paged_models.py new file mode 100644 index 000000000000..0ad7db521502 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/models/_paged_models.py @@ -0,0 +1,274 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class DatabaseAccountGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`DatabaseAccountGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DatabaseAccountGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(DatabaseAccountGetResultsPaged, self).__init__(*args, **kwargs) +class MetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`Metric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Metric]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricPaged, self).__init__(*args, **kwargs) +class UsagePaged(Paged): + """ + A paging container for iterating over a list of :class:`Usage ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Usage]'} + } + + def __init__(self, *args, **kwargs): + + super(UsagePaged, self).__init__(*args, **kwargs) +class MetricDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricDefinitionPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class PercentileMetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`PercentileMetric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PercentileMetric]'} + } + + def __init__(self, *args, **kwargs): + + super(PercentileMetricPaged, self).__init__(*args, **kwargs) +class PartitionMetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`PartitionMetric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PartitionMetric]'} + } + + def __init__(self, *args, **kwargs): + + super(PartitionMetricPaged, self).__init__(*args, **kwargs) +class PartitionUsagePaged(Paged): + """ + A paging container for iterating over a list of :class:`PartitionUsage ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PartitionUsage]'} + } + + def __init__(self, *args, **kwargs): + + super(PartitionUsagePaged, self).__init__(*args, **kwargs) +class SqlDatabaseGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlDatabaseGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlDatabaseGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlDatabaseGetResultsPaged, self).__init__(*args, **kwargs) +class SqlContainerGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlContainerGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlContainerGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlContainerGetResultsPaged, self).__init__(*args, **kwargs) +class SqlStoredProcedureGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlStoredProcedureGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlStoredProcedureGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlStoredProcedureGetResultsPaged, self).__init__(*args, **kwargs) +class SqlUserDefinedFunctionGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlUserDefinedFunctionGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlUserDefinedFunctionGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlUserDefinedFunctionGetResultsPaged, self).__init__(*args, **kwargs) +class SqlTriggerGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlTriggerGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlTriggerGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlTriggerGetResultsPaged, self).__init__(*args, **kwargs) +class MongoDBDatabaseGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`MongoDBDatabaseGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MongoDBDatabaseGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(MongoDBDatabaseGetResultsPaged, self).__init__(*args, **kwargs) +class MongoDBCollectionGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`MongoDBCollectionGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MongoDBCollectionGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(MongoDBCollectionGetResultsPaged, self).__init__(*args, **kwargs) +class TableGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`TableGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[TableGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(TableGetResultsPaged, self).__init__(*args, **kwargs) +class CassandraKeyspaceGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`CassandraKeyspaceGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CassandraKeyspaceGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(CassandraKeyspaceGetResultsPaged, self).__init__(*args, **kwargs) +class CassandraTableGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`CassandraTableGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CassandraTableGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(CassandraTableGetResultsPaged, self).__init__(*args, **kwargs) +class GremlinDatabaseGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`GremlinDatabaseGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GremlinDatabaseGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(GremlinDatabaseGetResultsPaged, self).__init__(*args, **kwargs) +class GremlinGraphGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`GremlinGraphGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GremlinGraphGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(GremlinGraphGetResultsPaged, self).__init__(*args, **kwargs) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/__init__.py new file mode 100644 index 000000000000..82963bb5681e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/__init__.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._database_accounts_operations import DatabaseAccountsOperations +from ._operations import Operations +from ._database_operations import DatabaseOperations +from ._collection_operations import CollectionOperations +from ._collection_region_operations import CollectionRegionOperations +from ._database_account_region_operations import DatabaseAccountRegionOperations +from ._percentile_source_target_operations import PercentileSourceTargetOperations +from ._percentile_target_operations import PercentileTargetOperations +from ._percentile_operations import PercentileOperations +from ._collection_partition_region_operations import CollectionPartitionRegionOperations +from ._collection_partition_operations import CollectionPartitionOperations +from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations +from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations +from ._sql_resources_operations import SqlResourcesOperations +from ._mongo_db_resources_operations import MongoDBResourcesOperations +from ._table_resources_operations import TableResourcesOperations +from ._cassandra_resources_operations import CassandraResourcesOperations +from ._gremlin_resources_operations import GremlinResourcesOperations + +__all__ = [ + 'DatabaseAccountsOperations', + 'Operations', + 'DatabaseOperations', + 'CollectionOperations', + 'CollectionRegionOperations', + 'DatabaseAccountRegionOperations', + 'PercentileSourceTargetOperations', + 'PercentileTargetOperations', + 'PercentileOperations', + 'CollectionPartitionRegionOperations', + 'CollectionPartitionOperations', + 'PartitionKeyRangeIdOperations', + 'PartitionKeyRangeIdRegionOperations', + 'SqlResourcesOperations', + 'MongoDBResourcesOperations', + 'TableResourcesOperations', + 'CassandraResourcesOperations', + 'GremlinResourcesOperations', +] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_cassandra_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_cassandra_resources_operations.py new file mode 100644 index 000000000000..f0220458c913 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_cassandra_resources_operations.py @@ -0,0 +1,1067 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class CassandraResourcesOperations(object): + """CassandraResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_cassandra_keyspaces( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Cassandra keyspaces under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of CassandraKeyspaceGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraKeyspaceGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraKeyspaceGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_cassandra_keyspaces.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.CassandraKeyspaceGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_cassandra_keyspaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces'} + + def get_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CassandraKeyspaceGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraKeyspaceGetResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_keyspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CassandraKeyspaceGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}'} + + + def _create_update_cassandra_keyspace_initial( + self, resource_group_name, account_name, keyspace_name, create_update_cassandra_keyspace_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_cassandra_keyspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_cassandra_keyspace_parameters, 'CassandraKeyspaceCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CassandraKeyspaceGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_name, create_update_cassandra_keyspace_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Cassandra keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to + provide for the current Cassandra keyspace. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraKeyspaceCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + CassandraKeyspaceGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraKeyspaceGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraKeyspaceGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_cassandra_keyspace_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + create_update_cassandra_keyspace_parameters=create_update_cassandra_keyspace_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CassandraKeyspaceGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}'} + + + def _delete_cassandra_keyspace_initial( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_cassandra_keyspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Cassandra keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_cassandra_keyspace_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}'} + + def get_cassandra_keyspace_throughput( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Cassandra Keyspace under an existing + Azure Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_keyspace_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_keyspace_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default'} + + + def _update_cassandra_keyspace_throughput_initial( + self, resource_group_name, account_name, keyspace_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_cassandra_keyspace_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_cassandra_keyspace_throughput( + self, resource_group_name, account_name, keyspace_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current Cassandra Keyspace. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_cassandra_keyspace_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_cassandra_keyspace_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default'} + + def list_cassandra_tables( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + """Lists the Cassandra table under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of CassandraTableGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraTableGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraTableGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_cassandra_tables.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.CassandraTableGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_cassandra_tables.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables'} + + def get_cassandra_table( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the Cassandra table under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CassandraTableGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraTableGetResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CassandraTableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}'} + + + def _create_update_cassandra_table_initial( + self, resource_group_name, account_name, keyspace_name, table_name, create_update_cassandra_table_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_cassandra_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_cassandra_table_parameters, 'CassandraTableCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CassandraTableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_cassandra_table( + self, resource_group_name, account_name, keyspace_name, table_name, create_update_cassandra_table_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Cassandra Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to + provide for the current Cassandra Table. + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraTableCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + CassandraTableGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraTableGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.CassandraTableGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_cassandra_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + table_name=table_name, + create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CassandraTableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}'} + + + def _delete_cassandra_table_initial( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_cassandra_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_cassandra_table( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Cassandra table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_cassandra_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + table_name=table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}'} + + def get_cassandra_table_throughput( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Cassandra table under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default'} + + + def _update_cassandra_table_throughput_initial( + self, resource_group_name, account_name, keyspace_name, table_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_cassandra_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_cassandra_table_throughput( + self, resource_group_name, account_name, keyspace_name, table_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Cassandra table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current Cassandra table. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_cassandra_table_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + table_name=table_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_cassandra_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_operations.py new file mode 100644 index 000000000000..90f87a9e2806 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_operations.py @@ -0,0 +1,288 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionOperations(object): + """CollectionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account and collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics'} + + def list_usages( + self, resource_group_name, account_name, database_rid, collection_rid, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent storage data) for the given + collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UsagePaged[~azure.mgmt.cosmosdb.v2019_08_01.models.Usage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages'} + + def list_metric_definitions( + self, resource_group_name, account_name, database_rid, collection_rid, custom_headers=None, raw=False, **operation_config): + """Retrieves metric definitions for the given collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricDefinitionPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.MetricDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_partition_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_partition_operations.py new file mode 100644 index 000000000000..dd4dd723c0e3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_partition_operations.py @@ -0,0 +1,210 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionPartitionOperations(object): + """CollectionPartitionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + collection, split by partition. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics'} + + def list_usages( + self, resource_group_name, account_name, database_rid, collection_rid, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent storage data) for the given + collection, split by partition. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionUsage + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionUsagePaged[~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionUsage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionUsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_partition_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_partition_region_operations.py new file mode 100644 index 000000000000..811507b3ec88 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_partition_region_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionPartitionRegionOperations(object): + """CollectionPartitionRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + collection and region, split by partition. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_region_operations.py new file mode 100644 index 000000000000..0e34ce410f25 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_collection_region_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionRegionOperations(object): + """CollectionRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account, collection and region. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_database_account_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_database_account_region_operations.py new file mode 100644 index 000000000000..e2e2f6d761bb --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_database_account_region_operations.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class DatabaseAccountRegionOperations(object): + """DatabaseAccountRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account and region. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_database_accounts_operations.py new file mode 100644 index 000000000000..01c49990e21d --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_database_accounts_operations.py @@ -0,0 +1,1428 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class DatabaseAccountsOperations(object): + """DatabaseAccountsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def get( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Retrieves the properties of an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountGetResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _update_initial( + self, resource_group_name, account_name, update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_parameters, 'DatabaseAccountUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, account_name, update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates the properties of an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param update_parameters: The parameters to provide for the current + database account. + :type update_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + DatabaseAccountGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + update_parameters=update_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _create_or_update_initial( + self, resource_group_name, account_name, create_update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_parameters, 'DatabaseAccountCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, account_name, create_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates an Azure Cosmos DB database account. The "Update" + method is preferred when performing updates on an account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param create_update_parameters: The parameters to provide for the + current database account. + :type create_update_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + DatabaseAccountGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + create_update_parameters=create_update_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _delete_initial( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, account_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _failover_priority_change_initial( + self, resource_group_name, account_name, failover_policies, custom_headers=None, raw=False, **operation_config): + failover_parameters = models.FailoverPolicies(failover_policies=failover_policies) + + # Construct URL + url = self.failover_priority_change.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(failover_parameters, 'FailoverPolicies') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def failover_priority_change( + self, resource_group_name, account_name, failover_policies, custom_headers=None, raw=False, polling=True, **operation_config): + """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. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param failover_policies: List of failover policies. + :type failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01.models.FailoverPolicy] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._failover_priority_change_initial( + resource_group_name=resource_group_name, + account_name=account_name, + failover_policies=failover_policies, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + failover_priority_change.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the Azure Cosmos DB database accounts available under the + subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DatabaseAccountGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DatabaseAccountGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists all the Azure Cosmos DB database accounts available under the + given resource group. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DatabaseAccountGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DatabaseAccountGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts'} + + def list_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the access keys for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListKeysResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountListKeysResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys'} + + def list_connection_strings( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the connection strings for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListConnectionStringsResult or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountListConnectionStringsResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_connection_strings.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListConnectionStringsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings'} + + + def _offline_region_initial( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, **operation_config): + region_parameter_for_offline = models.RegionForOnlineOffline(region=region) + + # Construct URL + url = self.offline_region.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(region_parameter_for_offline, 'RegionForOnlineOffline') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def offline_region( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, polling=True, **operation_config): + """Offline the specified region for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._offline_region_initial( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + offline_region.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion'} + + + def _online_region_initial( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, **operation_config): + region_parameter_for_online = models.RegionForOnlineOffline(region=region) + + # Construct URL + url = self.online_region.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(region_parameter_for_online, 'RegionForOnlineOffline') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def online_region( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, polling=True, **operation_config): + """Online the specified region for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._online_region_initial( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + online_region.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion'} + + def get_read_only_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the read-only access keys for the specified Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListReadOnlyKeysResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountListReadOnlyKeysResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_read_only_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListReadOnlyKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_read_only_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys'} + + def list_read_only_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the read-only access keys for the specified Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListReadOnlyKeysResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.DatabaseAccountListReadOnlyKeysResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_read_only_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListReadOnlyKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_read_only_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys'} + + + def _regenerate_key_initial( + self, resource_group_name, account_name, key_kind, custom_headers=None, raw=False, **operation_config): + key_to_regenerate = models.DatabaseAccountRegenerateKeyParameters(key_kind=key_kind) + + # Construct URL + url = self.regenerate_key.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(key_to_regenerate, 'DatabaseAccountRegenerateKeyParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def regenerate_key( + self, resource_group_name, account_name, key_kind, custom_headers=None, raw=False, polling=True, **operation_config): + """Regenerates an access key for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param key_kind: The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', + 'secondaryReadonly' + :type key_kind: str or ~azure.mgmt.cosmosdb.v2019_08_01.models.KeyKind + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._regenerate_key_initial( + resource_group_name=resource_group_name, + account_name=account_name, + key_kind=key_kind, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey'} + + def check_name_exists( + self, account_name, custom_headers=None, raw=False, **operation_config): + """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. + + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: bool or ClientRawResponse if raw=true + :rtype: bool or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_name_exists.metadata['url'] + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = (response.status_code == 200) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + return deserialized + check_name_exists.metadata = {'url': '/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}'} + + def list_metrics( + self, resource_group_name, account_name, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics'} + + def list_usages( + self, resource_group_name, account_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent data) for the given database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UsagePaged[~azure.mgmt.cosmosdb.v2019_08_01.models.Usage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages'} + + def list_metric_definitions( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Retrieves metric definitions for the given database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricDefinitionPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.MetricDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_database_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_database_operations.py new file mode 100644 index 000000000000..bbf6fb0f79f8 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_database_operations.py @@ -0,0 +1,278 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class DatabaseOperations(object): + """DatabaseOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account and database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics'} + + def list_usages( + self, resource_group_name, account_name, database_rid, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent data) for the given database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.UsagePaged[~azure.mgmt.cosmosdb.v2019_08_01.models.Usage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages'} + + def list_metric_definitions( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + """Retrieves metric definitions for the given database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MetricDefinitionPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.MetricDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_gremlin_resources_operations.py new file mode 100644 index 000000000000..d7fb6a049010 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_gremlin_resources_operations.py @@ -0,0 +1,1065 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class GremlinResourcesOperations(object): + """GremlinResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_gremlin_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Gremlin databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GremlinDatabaseGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinDatabaseGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinDatabaseGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_gremlin_databases.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GremlinDatabaseGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_gremlin_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases'} + + def get_gremlin_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin databases under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GremlinDatabaseGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinDatabaseGetResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GremlinDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}'} + + + def _create_update_gremlin_database_initial( + self, resource_group_name, account_name, database_name, create_update_gremlin_database_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_gremlin_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_gremlin_database_parameters, 'GremlinDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GremlinDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_gremlin_database( + self, resource_group_name, account_name, database_name, create_update_gremlin_database_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param create_update_gremlin_database_parameters: The parameters to + provide for the current Gremlin database. + :type create_update_gremlin_database_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinDatabaseCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + GremlinDatabaseGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinDatabaseGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinDatabaseGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + create_update_gremlin_database_parameters=create_update_gremlin_database_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GremlinDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}'} + + + def _delete_gremlin_database_initial( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_gremlin_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_gremlin_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}'} + + def get_gremlin_database_throughput( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Gremlin database under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default'} + + + def _update_gremlin_database_throughput_initial( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_gremlin_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_gremlin_database_throughput( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current Gremlin database. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_gremlin_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_gremlin_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default'} + + def list_gremlin_graphs( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the Gremlin graph under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GremlinGraphGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinGraphGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinGraphGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_gremlin_graphs.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GremlinGraphGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_gremlin_graphs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs'} + + def get_gremlin_graph( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin graph under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GremlinGraphGetResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinGraphGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_graph.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GremlinGraphGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_graph.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'} + + + def _create_update_gremlin_graph_initial( + self, resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_gremlin_graph.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_gremlin_graph_parameters, 'GremlinGraphCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GremlinGraphGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_gremlin_graph( + self, resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to + provide for the current Gremlin graph. + :type create_update_gremlin_graph_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinGraphCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns GremlinGraphGetResults + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinGraphGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.GremlinGraphGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_gremlin_graph_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + create_update_gremlin_graph_parameters=create_update_gremlin_graph_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GremlinGraphGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_gremlin_graph.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'} + + + def _delete_gremlin_graph_initial( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_gremlin_graph.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_gremlin_graph( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Gremlin graph. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_gremlin_graph_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_gremlin_graph.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'} + + def get_gremlin_graph_throughput( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin graph throughput under an existing Azure Cosmos DB + database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_graph_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_graph_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default'} + + + def _update_gremlin_graph_throughput_initial( + self, resource_group_name, account_name, database_name, graph_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_gremlin_graph_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_gremlin_graph_throughput( + self, resource_group_name, account_name, database_name, graph_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current Gremlin graph. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_gremlin_graph_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_gremlin_graph_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_mongo_db_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_mongo_db_resources_operations.py new file mode 100644 index 000000000000..210202c9845a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_mongo_db_resources_operations.py @@ -0,0 +1,1067 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class MongoDBResourcesOperations(object): + """MongoDBResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_mongo_db_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the MongoDB databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MongoDBDatabaseGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBDatabaseGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBDatabaseGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_mongo_db_databases.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MongoDBDatabaseGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_mongo_db_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases'} + + def get_mongo_db_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the MongoDB databases under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MongoDBDatabaseGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBDatabaseGetResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MongoDBDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}'} + + + def _create_update_mongo_db_database_initial( + self, resource_group_name, account_name, database_name, create_update_mongo_db_database_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_mongo_db_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_mongo_db_database_parameters, 'MongoDBDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MongoDBDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_mongo_db_database( + self, resource_group_name, account_name, database_name, create_update_mongo_db_database_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or updates Azure Cosmos DB MongoDB database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param create_update_mongo_db_database_parameters: The parameters to + provide for the current MongoDB database. + :type create_update_mongo_db_database_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBDatabaseCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + MongoDBDatabaseGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBDatabaseGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBDatabaseGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_mongo_db_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + create_update_mongo_db_database_parameters=create_update_mongo_db_database_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('MongoDBDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_mongo_db_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}'} + + + def _delete_mongo_db_database_initial( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_mongo_db_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_mongo_db_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB MongoDB database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_mongo_db_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_mongo_db_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}'} + + def get_mongo_db_database_throughput( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the MongoDB database under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default'} + + + def _update_mongo_db_database_throughput_initial( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_mongo_db_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_mongo_db_database_throughput( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of the an Azure Cosmos DB MongoDB database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current MongoDB database. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_mongo_db_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_mongo_db_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default'} + + def list_mongo_db_collections( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the MongoDB collection under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MongoDBCollectionGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBCollectionGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBCollectionGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_mongo_db_collections.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MongoDBCollectionGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_mongo_db_collections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections'} + + def get_mongo_db_collection( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, **operation_config): + """Gets the MongoDB collection under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MongoDBCollectionGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBCollectionGetResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_collection.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MongoDBCollectionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'} + + + def _create_update_mongo_db_collection_initial( + self, resource_group_name, account_name, database_name, collection_name, create_update_mongo_db_collection_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_mongo_db_collection.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_mongo_db_collection_parameters, 'MongoDBCollectionCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MongoDBCollectionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_mongo_db_collection( + self, resource_group_name, account_name, database_name, collection_name, create_update_mongo_db_collection_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB MongoDB Collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param create_update_mongo_db_collection_parameters: The parameters to + provide for the current MongoDB Collection. + :type create_update_mongo_db_collection_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBCollectionCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + MongoDBCollectionGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBCollectionGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.MongoDBCollectionGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_mongo_db_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + create_update_mongo_db_collection_parameters=create_update_mongo_db_collection_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('MongoDBCollectionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'} + + + def _delete_mongo_db_collection_initial( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_mongo_db_collection.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_mongo_db_collection( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB MongoDB Collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_mongo_db_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'} + + def get_mongo_db_collection_throughput( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the MongoDB collection under an existing + Azure Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_collection_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_collection_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default'} + + + def _update_mongo_db_collection_throughput_initial( + self, resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_mongo_db_collection_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_mongo_db_collection_throughput( + self, resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current MongoDB collection. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_mongo_db_collection_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_mongo_db_collection_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_operations.py new file mode 100644 index 000000000000..4789cfeed25c --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_operations.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Cosmos DB Resource Provider operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.OperationPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.Operation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.DocumentDB/operations'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_partition_key_range_id_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_partition_key_range_id_operations.py new file mode 100644 index 000000000000..7b03e05fdb3b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_partition_key_range_id_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PartitionKeyRangeIdOperations(object): + """PartitionKeyRangeIdOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, collection_rid, partition_key_range_id, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + partition key range id. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get + data. + :type partition_key_range_id: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str'), + 'partitionKeyRangeId': self._serialize.url("partition_key_range_id", partition_key_range_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_partition_key_range_id_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_partition_key_range_id_region_operations.py new file mode 100644 index 000000000000..b1c040535f0c --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_partition_key_range_id_region_operations.py @@ -0,0 +1,133 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PartitionKeyRangeIdRegionOperations(object): + """PartitionKeyRangeIdRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, database_rid, collection_rid, partition_key_range_id, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + partition key range id and region. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get + data. + :type partition_key_range_id: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str'), + 'partitionKeyRangeId': self._serialize.url("partition_key_range_id", partition_key_range_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_percentile_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_percentile_operations.py new file mode 100644 index 000000000000..4c69f2391f41 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_percentile_operations.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PercentileOperations(object): + """PercentileOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account. This url is only for PBS and Replication Latency + data. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PercentileMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.PercentileMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.PercentileMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PercentileMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_percentile_source_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_percentile_source_target_operations.py new file mode 100644 index 000000000000..16c3060496dc --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_percentile_source_target_operations.py @@ -0,0 +1,128 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PercentileSourceTargetOperations(object): + """PercentileSourceTargetOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, source_region, target_region, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + account, source and target region. This url is only for PBS and + Replication Latency data. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param source_region: Source region from which data is written. Cosmos + DB region, with spaces between words and each word capitalized. + :type source_region: str + :param target_region: Target region to which data is written. Cosmos + DB region, with spaces between words and each word capitalized. + :type target_region: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PercentileMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.PercentileMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.PercentileMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'sourceRegion': self._serialize.url("source_region", source_region, 'str'), + 'targetRegion': self._serialize.url("target_region", target_region, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PercentileMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_percentile_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_percentile_target_operations.py new file mode 100644 index 000000000000..a9b22ef8a2d8 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_percentile_target_operations.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PercentileTargetOperations(object): + """PercentileTargetOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, target_region, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + account target region. This url is only for PBS and Replication Latency + data. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param target_region: Target region to which data is written. Cosmos + DB region, with spaces between words and each word capitalized. + :type target_region: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PercentileMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.PercentileMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.PercentileMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'targetRegion': self._serialize.url("target_region", target_region, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PercentileMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_sql_resources_operations.py new file mode 100644 index 000000000000..3220f8575062 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_sql_resources_operations.py @@ -0,0 +1,2133 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class SqlResourcesOperations(object): + """SqlResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_sql_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlDatabaseGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlDatabaseGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlDatabaseGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_databases.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlDatabaseGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases'} + + def get_sql_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL database under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlDatabaseGetResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlDatabaseGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}'} + + + def _create_update_sql_database_initial( + self, resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_database_parameters, 'SqlDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_database( + self, resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param create_update_sql_database_parameters: The parameters to + provide for the current SQL database. + :type create_update_sql_database_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlDatabaseCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SqlDatabaseGetResults + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlDatabaseGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlDatabaseGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + create_update_sql_database_parameters=create_update_sql_database_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}'} + + + def _delete_sql_database_initial( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}'} + + def get_sql_database_throughput( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the SQL database under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default'} + + + def _update_sql_database_throughput_initial( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_sql_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_sql_database_throughput( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param update_throughput_parameters: The parameters to provide for the + RUs per second of the current SQL database. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_sql_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_sql_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default'} + + def list_sql_containers( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlContainerGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlContainerGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlContainerGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_containers.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlContainerGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers'} + + def get_sql_container( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlContainerGetResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlContainerGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_container.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlContainerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'} + + + def _create_update_sql_container_initial( + self, resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_container.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_container_parameters, 'SqlContainerCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlContainerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_container( + self, resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param create_update_sql_container_parameters: The parameters to + provide for the current SQL container. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlContainerCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SqlContainerGetResults + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlContainerGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlContainerGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + create_update_sql_container_parameters=create_update_sql_container_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlContainerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'} + + + def _delete_sql_container_initial( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_container.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_container( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'} + + def get_sql_container_throughput( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the SQL container under an existing Azure + Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_container_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_container_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default'} + + + def _update_sql_container_throughput_initial( + self, resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_sql_container_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_sql_container_throughput( + self, resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param update_throughput_parameters: The parameters to provide for the + RUs per second of the current SQL container. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_sql_container_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_sql_container_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default'} + + def list_sql_stored_procedures( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL storedProcedure under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlStoredProcedureGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlStoredProcedureGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlStoredProcedureGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_stored_procedures.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlStoredProcedureGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_stored_procedures.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/'} + + def get_sql_stored_procedure( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL storedProcedure under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. + :type stored_procedure_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlStoredProcedureGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlStoredProcedureGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_stored_procedure.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'storedProcedureName': self._serialize.url("stored_procedure_name", stored_procedure_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlStoredProcedureGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_stored_procedure.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}'} + + + def _create_update_sql_stored_procedure_initial( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_stored_procedure.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'storedProcedureName': self._serialize.url("stored_procedure_name", stored_procedure_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_stored_procedure_parameters, 'SqlStoredProcedureCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlStoredProcedureGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_stored_procedure( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL storedProcedure. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters + to provide for the current SQL storedProcedure. + :type create_update_sql_stored_procedure_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlStoredProcedureCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + SqlStoredProcedureGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlStoredProcedureGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlStoredProcedureGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_stored_procedure_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, + create_update_sql_stored_procedure_parameters=create_update_sql_stored_procedure_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlStoredProcedureGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_stored_procedure.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}'} + + + def _delete_sql_stored_procedure_initial( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_stored_procedure.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'storedProcedureName': self._serialize.url("stored_procedure_name", stored_procedure_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_stored_procedure( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL storedProcedure. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. + :type stored_procedure_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_stored_procedure_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_stored_procedure.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}'} + + def list_sql_user_defined_functions( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL userDefinedFunction under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlUserDefinedFunctionGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlUserDefinedFunctionGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlUserDefinedFunctionGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_user_defined_functions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlUserDefinedFunctionGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_user_defined_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/'} + + def get_sql_user_defined_function( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL userDefinedFunction under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. + :type user_defined_function_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlUserDefinedFunctionGetResults or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlUserDefinedFunctionGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_user_defined_function.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'userDefinedFunctionName': self._serialize.url("user_defined_function_name", user_defined_function_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlUserDefinedFunctionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_user_defined_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}'} + + + def _create_update_sql_user_defined_function_initial( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_user_defined_function.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'userDefinedFunctionName': self._serialize.url("user_defined_function_name", user_defined_function_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_user_defined_function_parameters, 'SqlUserDefinedFunctionCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlUserDefinedFunctionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_user_defined_function( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL userDefinedFunction. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The + parameters to provide for the current SQL userDefinedFunction. + :type create_update_sql_user_defined_function_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlUserDefinedFunctionCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + SqlUserDefinedFunctionGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlUserDefinedFunctionGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlUserDefinedFunctionGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_user_defined_function_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, + create_update_sql_user_defined_function_parameters=create_update_sql_user_defined_function_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlUserDefinedFunctionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_user_defined_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}'} + + + def _delete_sql_user_defined_function_initial( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_user_defined_function.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'userDefinedFunctionName': self._serialize.url("user_defined_function_name", user_defined_function_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_user_defined_function( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. + :type user_defined_function_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_user_defined_function_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_user_defined_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}'} + + def list_sql_triggers( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL trigger under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlTriggerGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlTriggerGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlTriggerGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_triggers.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlTriggerGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/'} + + def get_sql_trigger( + self, resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL trigger under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. + :type trigger_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlTriggerGetResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlTriggerGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_trigger.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'triggerName': self._serialize.url("trigger_name", trigger_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlTriggerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}'} + + + def _create_update_sql_trigger_initial( + self, resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_trigger.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'triggerName': self._serialize.url("trigger_name", trigger_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_trigger_parameters, 'SqlTriggerCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlTriggerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_trigger( + self, resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL trigger. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide + for the current SQL trigger. + :type create_update_sql_trigger_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.SqlTriggerCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SqlTriggerGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlTriggerGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.SqlTriggerGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_trigger_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, + create_update_sql_trigger_parameters=create_update_sql_trigger_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlTriggerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}'} + + + def _delete_sql_trigger_initial( + self, resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_trigger.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'triggerName': self._serialize.url("trigger_name", trigger_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_trigger( + self, resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL trigger. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. + :type trigger_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_trigger_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_table_resources_operations.py new file mode 100644 index 000000000000..89c1c7b09437 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/operations/_table_resources_operations.py @@ -0,0 +1,541 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class TableResourcesOperations(object): + """TableResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_tables( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Tables under an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of TableGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.TableGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01.models.TableGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_tables.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TableGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_tables.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables'} + + def get_table( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the Tables under an existing Azure Cosmos DB database account with + the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TableGetResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.v2019_08_01.models.TableGetResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}'} + + + def _create_update_table_initial( + self, resource_group_name, account_name, table_name, create_update_table_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_table_parameters, 'TableCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_table( + self, resource_group_name, account_name, table_name, create_update_table_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for + the current Table. + :type create_update_table_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.TableCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns TableGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.TableGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.TableGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + create_update_table_parameters=create_update_table_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('TableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}'} + + + def _delete_table_initial( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_table( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}'} + + def get_table_throughput( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Table under an existing Azure Cosmos DB + database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default'} + + + def _update_table_throughput_initial( + self, resource_group_name, account_name, table_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_table_throughput( + self, resource_group_name, account_name, table_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the + RUs per second of the current Table. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_table_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/version.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/version.py new file mode 100644 index 000000000000..b99c58c616c0 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2019-08-01" + diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/__init__.py new file mode 100644 index 000000000000..9edd8273e121 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import CosmosDBConfiguration +from ._cosmos_db import CosmosDB +__all__ = ['CosmosDB', 'CosmosDBConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/_configuration.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/_configuration.py new file mode 100644 index 000000000000..cb9f74d058c5 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/_configuration.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class CosmosDBConfiguration(AzureConfiguration): + """Configuration for CosmosDB + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param subscription_id1: The ID of the target subscription. + :type subscription_id1: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, subscription_id1, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if subscription_id1 is None: + raise ValueError("Parameter 'subscription_id1' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(CosmosDBConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-cosmosdb/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + self.subscription_id1 = subscription_id1 diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/_cosmos_db.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/_cosmos_db.py new file mode 100644 index 000000000000..133609ee4576 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/_cosmos_db.py @@ -0,0 +1,145 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import CosmosDBConfiguration +from .operations import DatabaseAccountsOperations +from .operations import Operations +from .operations import DatabaseOperations +from .operations import CollectionOperations +from .operations import CollectionRegionOperations +from .operations import DatabaseAccountRegionOperations +from .operations import PercentileSourceTargetOperations +from .operations import PercentileTargetOperations +from .operations import PercentileOperations +from .operations import CollectionPartitionRegionOperations +from .operations import CollectionPartitionOperations +from .operations import PartitionKeyRangeIdOperations +from .operations import PartitionKeyRangeIdRegionOperations +from .operations import SqlResourcesOperations +from .operations import MongoDBResourcesOperations +from .operations import TableResourcesOperations +from .operations import CassandraResourcesOperations +from .operations import GremlinResourcesOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from . import models + + +class CosmosDB(SDKClient): + """Azure Cosmos DB Database Service Resource Provider REST API + + :ivar config: Configuration for client. + :vartype config: CosmosDBConfiguration + + :ivar database_accounts: DatabaseAccounts operations + :vartype database_accounts: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.DatabaseAccountsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.Operations + :ivar database: Database operations + :vartype database: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.DatabaseOperations + :ivar collection: Collection operations + :vartype collection: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.CollectionOperations + :ivar collection_region: CollectionRegion operations + :vartype collection_region: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.CollectionRegionOperations + :ivar database_account_region: DatabaseAccountRegion operations + :vartype database_account_region: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.DatabaseAccountRegionOperations + :ivar percentile_source_target: PercentileSourceTarget operations + :vartype percentile_source_target: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.PercentileSourceTargetOperations + :ivar percentile_target: PercentileTarget operations + :vartype percentile_target: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.PercentileTargetOperations + :ivar percentile: Percentile operations + :vartype percentile: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.PercentileOperations + :ivar collection_partition_region: CollectionPartitionRegion operations + :vartype collection_partition_region: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.CollectionPartitionRegionOperations + :ivar collection_partition: CollectionPartition operations + :vartype collection_partition: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.CollectionPartitionOperations + :ivar partition_key_range_id: PartitionKeyRangeId operations + :vartype partition_key_range_id: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.PartitionKeyRangeIdOperations + :ivar partition_key_range_id_region: PartitionKeyRangeIdRegion operations + :vartype partition_key_range_id_region: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.PartitionKeyRangeIdRegionOperations + :ivar sql_resources: SqlResources operations + :vartype sql_resources: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.SqlResourcesOperations + :ivar mongo_db_resources: MongoDBResources operations + :vartype mongo_db_resources: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.MongoDBResourcesOperations + :ivar table_resources: TableResources operations + :vartype table_resources: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.TableResourcesOperations + :ivar cassandra_resources: CassandraResources operations + :vartype cassandra_resources: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.CassandraResourcesOperations + :ivar gremlin_resources: GremlinResources operations + :vartype gremlin_resources: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.GremlinResourcesOperations + :ivar private_link_resources: PrivateLinkResources operations + :vartype private_link_resources: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnections operations + :vartype private_endpoint_connections: azure.mgmt.cosmosdb.v2019_08_01_preview.operations.PrivateEndpointConnectionsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param subscription_id1: The ID of the target subscription. + :type subscription_id1: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, subscription_id1, base_url=None): + + self.config = CosmosDBConfiguration(credentials, subscription_id, subscription_id1, base_url) + super(CosmosDB, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.database_accounts = DatabaseAccountsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.database = DatabaseOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection = CollectionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection_region = CollectionRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.database_account_region = DatabaseAccountRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.percentile_source_target = PercentileSourceTargetOperations( + self._client, self.config, self._serialize, self._deserialize) + self.percentile_target = PercentileTargetOperations( + self._client, self.config, self._serialize, self._deserialize) + self.percentile = PercentileOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection_partition_region = CollectionPartitionRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.collection_partition = CollectionPartitionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.partition_key_range_id = PartitionKeyRangeIdOperations( + self._client, self.config, self._serialize, self._deserialize) + self.partition_key_range_id_region = PartitionKeyRangeIdRegionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.sql_resources = SqlResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.mongo_db_resources = MongoDBResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.table_resources = TableResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.cassandra_resources = CassandraResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.gremlin_resources = GremlinResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/__init__.py new file mode 100644 index 000000000000..64f1f0ac7799 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/__init__.py @@ -0,0 +1,369 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ARMProxyResource + from ._models_py3 import ARMResourceProperties + from ._models_py3 import AzureEntityResource + from ._models_py3 import Capability + from ._models_py3 import CassandraKeyspaceCreateUpdateParameters + from ._models_py3 import CassandraKeyspaceGetResults + from ._models_py3 import CassandraKeyspaceResource + from ._models_py3 import CassandraPartitionKey + from ._models_py3 import CassandraSchema + from ._models_py3 import CassandraTableCreateUpdateParameters + from ._models_py3 import CassandraTableGetResults + from ._models_py3 import CassandraTableResource + from ._models_py3 import ClusterKey + from ._models_py3 import Column + from ._models_py3 import ConflictResolutionPolicy + from ._models_py3 import ConsistencyPolicy + from ._models_py3 import ContainerPartitionKey + from ._models_py3 import DatabaseAccountConnectionString + from ._models_py3 import DatabaseAccountCreateUpdateParameters + from ._models_py3 import DatabaseAccountGetResults + from ._models_py3 import DatabaseAccountListConnectionStringsResult + from ._models_py3 import DatabaseAccountListKeysResult + from ._models_py3 import DatabaseAccountListReadOnlyKeysResult + from ._models_py3 import DatabaseAccountRegenerateKeyParameters + from ._models_py3 import DatabaseAccountUpdateParameters + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ExcludedPath + from ._models_py3 import ExtendedResourceProperties + from ._models_py3 import FailoverPolicies + from ._models_py3 import FailoverPolicy + from ._models_py3 import GremlinDatabaseCreateUpdateParameters + from ._models_py3 import GremlinDatabaseGetResults + from ._models_py3 import GremlinDatabaseResource + from ._models_py3 import GremlinGraphCreateUpdateParameters + from ._models_py3 import GremlinGraphGetResults + from ._models_py3 import GremlinGraphResource + from ._models_py3 import IncludedPath + from ._models_py3 import Indexes + from ._models_py3 import IndexingPolicy + from ._models_py3 import Location + from ._models_py3 import Metric + from ._models_py3 import MetricAvailability + from ._models_py3 import MetricDefinition + from ._models_py3 import MetricName + from ._models_py3 import MetricValue + from ._models_py3 import MongoDBCollectionCreateUpdateParameters + from ._models_py3 import MongoDBCollectionGetResults + from ._models_py3 import MongoDBCollectionResource + from ._models_py3 import MongoDBDatabaseCreateUpdateParameters + from ._models_py3 import MongoDBDatabaseGetResults + from ._models_py3 import MongoDBDatabaseResource + from ._models_py3 import MongoIndex + from ._models_py3 import MongoIndexKeys + from ._models_py3 import MongoIndexOptions + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import PartitionMetric + from ._models_py3 import PartitionUsage + from ._models_py3 import PercentileMetric + from ._models_py3 import PercentileMetricValue + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointProperty + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkServiceConnectionStateProperty + from ._models_py3 import ProxyResource + from ._models_py3 import RegionForOnlineOffline + from ._models_py3 import Resource + from ._models_py3 import SqlContainerCreateUpdateParameters + from ._models_py3 import SqlContainerGetResults + from ._models_py3 import SqlContainerResource + from ._models_py3 import SqlDatabaseCreateUpdateParameters + from ._models_py3 import SqlDatabaseGetResults + from ._models_py3 import SqlDatabaseResource + from ._models_py3 import SqlStoredProcedureCreateUpdateParameters + from ._models_py3 import SqlStoredProcedureGetResults + from ._models_py3 import SqlStoredProcedureResource + from ._models_py3 import SqlTriggerCreateUpdateParameters + from ._models_py3 import SqlTriggerGetResults + from ._models_py3 import SqlTriggerResource + from ._models_py3 import SqlUserDefinedFunctionCreateUpdateParameters + from ._models_py3 import SqlUserDefinedFunctionGetResults + from ._models_py3 import SqlUserDefinedFunctionResource + from ._models_py3 import TableCreateUpdateParameters + from ._models_py3 import TableGetResults + from ._models_py3 import TableResource + from ._models_py3 import ThroughputSettingsGetResults + from ._models_py3 import ThroughputSettingsResource + from ._models_py3 import ThroughputSettingsUpdateParameters + from ._models_py3 import TrackedResource + from ._models_py3 import UniqueKey + from ._models_py3 import UniqueKeyPolicy + from ._models_py3 import Usage + from ._models_py3 import VirtualNetworkRule +except (SyntaxError, ImportError): + from ._models import ARMProxyResource + from ._models import ARMResourceProperties + from ._models import AzureEntityResource + from ._models import Capability + from ._models import CassandraKeyspaceCreateUpdateParameters + from ._models import CassandraKeyspaceGetResults + from ._models import CassandraKeyspaceResource + from ._models import CassandraPartitionKey + from ._models import CassandraSchema + from ._models import CassandraTableCreateUpdateParameters + from ._models import CassandraTableGetResults + from ._models import CassandraTableResource + from ._models import ClusterKey + from ._models import Column + from ._models import ConflictResolutionPolicy + from ._models import ConsistencyPolicy + from ._models import ContainerPartitionKey + from ._models import DatabaseAccountConnectionString + from ._models import DatabaseAccountCreateUpdateParameters + from ._models import DatabaseAccountGetResults + from ._models import DatabaseAccountListConnectionStringsResult + from ._models import DatabaseAccountListKeysResult + from ._models import DatabaseAccountListReadOnlyKeysResult + from ._models import DatabaseAccountRegenerateKeyParameters + from ._models import DatabaseAccountUpdateParameters + from ._models import ErrorResponse, ErrorResponseException + from ._models import ExcludedPath + from ._models import ExtendedResourceProperties + from ._models import FailoverPolicies + from ._models import FailoverPolicy + from ._models import GremlinDatabaseCreateUpdateParameters + from ._models import GremlinDatabaseGetResults + from ._models import GremlinDatabaseResource + from ._models import GremlinGraphCreateUpdateParameters + from ._models import GremlinGraphGetResults + from ._models import GremlinGraphResource + from ._models import IncludedPath + from ._models import Indexes + from ._models import IndexingPolicy + from ._models import Location + from ._models import Metric + from ._models import MetricAvailability + from ._models import MetricDefinition + from ._models import MetricName + from ._models import MetricValue + from ._models import MongoDBCollectionCreateUpdateParameters + from ._models import MongoDBCollectionGetResults + from ._models import MongoDBCollectionResource + from ._models import MongoDBDatabaseCreateUpdateParameters + from ._models import MongoDBDatabaseGetResults + from ._models import MongoDBDatabaseResource + from ._models import MongoIndex + from ._models import MongoIndexKeys + from ._models import MongoIndexOptions + from ._models import Operation + from ._models import OperationDisplay + from ._models import PartitionMetric + from ._models import PartitionUsage + from ._models import PercentileMetric + from ._models import PercentileMetricValue + from ._models import PrivateEndpointConnection + from ._models import PrivateEndpointProperty + from ._models import PrivateLinkResource + from ._models import PrivateLinkServiceConnectionStateProperty + from ._models import ProxyResource + from ._models import RegionForOnlineOffline + from ._models import Resource + from ._models import SqlContainerCreateUpdateParameters + from ._models import SqlContainerGetResults + from ._models import SqlContainerResource + from ._models import SqlDatabaseCreateUpdateParameters + from ._models import SqlDatabaseGetResults + from ._models import SqlDatabaseResource + from ._models import SqlStoredProcedureCreateUpdateParameters + from ._models import SqlStoredProcedureGetResults + from ._models import SqlStoredProcedureResource + from ._models import SqlTriggerCreateUpdateParameters + from ._models import SqlTriggerGetResults + from ._models import SqlTriggerResource + from ._models import SqlUserDefinedFunctionCreateUpdateParameters + from ._models import SqlUserDefinedFunctionGetResults + from ._models import SqlUserDefinedFunctionResource + from ._models import TableCreateUpdateParameters + from ._models import TableGetResults + from ._models import TableResource + from ._models import ThroughputSettingsGetResults + from ._models import ThroughputSettingsResource + from ._models import ThroughputSettingsUpdateParameters + from ._models import TrackedResource + from ._models import UniqueKey + from ._models import UniqueKeyPolicy + from ._models import Usage + from ._models import VirtualNetworkRule +from ._paged_models import CassandraKeyspaceGetResultsPaged +from ._paged_models import CassandraTableGetResultsPaged +from ._paged_models import DatabaseAccountGetResultsPaged +from ._paged_models import GremlinDatabaseGetResultsPaged +from ._paged_models import GremlinGraphGetResultsPaged +from ._paged_models import MetricDefinitionPaged +from ._paged_models import MetricPaged +from ._paged_models import MongoDBCollectionGetResultsPaged +from ._paged_models import MongoDBDatabaseGetResultsPaged +from ._paged_models import OperationPaged +from ._paged_models import PartitionMetricPaged +from ._paged_models import PartitionUsagePaged +from ._paged_models import PercentileMetricPaged +from ._paged_models import PrivateEndpointConnectionPaged +from ._paged_models import PrivateLinkResourcePaged +from ._paged_models import SqlContainerGetResultsPaged +from ._paged_models import SqlDatabaseGetResultsPaged +from ._paged_models import SqlStoredProcedureGetResultsPaged +from ._paged_models import SqlTriggerGetResultsPaged +from ._paged_models import SqlUserDefinedFunctionGetResultsPaged +from ._paged_models import TableGetResultsPaged +from ._paged_models import UsagePaged +from ._cosmos_db_enums import ( + DatabaseAccountKind, + DatabaseAccountOfferType, + DefaultConsistencyLevel, + ConnectorOffer, + IndexingMode, + DataType, + IndexKind, + PartitionKind, + ConflictResolutionMode, + TriggerType, + TriggerOperation, + KeyKind, + UnitType, + PrimaryAggregationType, +) + +__all__ = [ + 'ARMProxyResource', + 'ARMResourceProperties', + 'AzureEntityResource', + 'Capability', + 'CassandraKeyspaceCreateUpdateParameters', + 'CassandraKeyspaceGetResults', + 'CassandraKeyspaceResource', + 'CassandraPartitionKey', + 'CassandraSchema', + 'CassandraTableCreateUpdateParameters', + 'CassandraTableGetResults', + 'CassandraTableResource', + 'ClusterKey', + 'Column', + 'ConflictResolutionPolicy', + 'ConsistencyPolicy', + 'ContainerPartitionKey', + 'DatabaseAccountConnectionString', + 'DatabaseAccountCreateUpdateParameters', + 'DatabaseAccountGetResults', + 'DatabaseAccountListConnectionStringsResult', + 'DatabaseAccountListKeysResult', + 'DatabaseAccountListReadOnlyKeysResult', + 'DatabaseAccountRegenerateKeyParameters', + 'DatabaseAccountUpdateParameters', + 'ErrorResponse', 'ErrorResponseException', + 'ExcludedPath', + 'ExtendedResourceProperties', + 'FailoverPolicies', + 'FailoverPolicy', + 'GremlinDatabaseCreateUpdateParameters', + 'GremlinDatabaseGetResults', + 'GremlinDatabaseResource', + 'GremlinGraphCreateUpdateParameters', + 'GremlinGraphGetResults', + 'GremlinGraphResource', + 'IncludedPath', + 'Indexes', + 'IndexingPolicy', + 'Location', + 'Metric', + 'MetricAvailability', + 'MetricDefinition', + 'MetricName', + 'MetricValue', + 'MongoDBCollectionCreateUpdateParameters', + 'MongoDBCollectionGetResults', + 'MongoDBCollectionResource', + 'MongoDBDatabaseCreateUpdateParameters', + 'MongoDBDatabaseGetResults', + 'MongoDBDatabaseResource', + 'MongoIndex', + 'MongoIndexKeys', + 'MongoIndexOptions', + 'Operation', + 'OperationDisplay', + 'PartitionMetric', + 'PartitionUsage', + 'PercentileMetric', + 'PercentileMetricValue', + 'PrivateEndpointConnection', + 'PrivateEndpointProperty', + 'PrivateLinkResource', + 'PrivateLinkServiceConnectionStateProperty', + 'ProxyResource', + 'RegionForOnlineOffline', + 'Resource', + 'SqlContainerCreateUpdateParameters', + 'SqlContainerGetResults', + 'SqlContainerResource', + 'SqlDatabaseCreateUpdateParameters', + 'SqlDatabaseGetResults', + 'SqlDatabaseResource', + 'SqlStoredProcedureCreateUpdateParameters', + 'SqlStoredProcedureGetResults', + 'SqlStoredProcedureResource', + 'SqlTriggerCreateUpdateParameters', + 'SqlTriggerGetResults', + 'SqlTriggerResource', + 'SqlUserDefinedFunctionCreateUpdateParameters', + 'SqlUserDefinedFunctionGetResults', + 'SqlUserDefinedFunctionResource', + 'TableCreateUpdateParameters', + 'TableGetResults', + 'TableResource', + 'ThroughputSettingsGetResults', + 'ThroughputSettingsResource', + 'ThroughputSettingsUpdateParameters', + 'TrackedResource', + 'UniqueKey', + 'UniqueKeyPolicy', + 'Usage', + 'VirtualNetworkRule', + 'DatabaseAccountGetResultsPaged', + 'MetricPaged', + 'UsagePaged', + 'MetricDefinitionPaged', + 'OperationPaged', + 'PercentileMetricPaged', + 'PartitionMetricPaged', + 'PartitionUsagePaged', + 'SqlDatabaseGetResultsPaged', + 'SqlContainerGetResultsPaged', + 'SqlStoredProcedureGetResultsPaged', + 'SqlUserDefinedFunctionGetResultsPaged', + 'SqlTriggerGetResultsPaged', + 'MongoDBDatabaseGetResultsPaged', + 'MongoDBCollectionGetResultsPaged', + 'TableGetResultsPaged', + 'CassandraKeyspaceGetResultsPaged', + 'CassandraTableGetResultsPaged', + 'GremlinDatabaseGetResultsPaged', + 'GremlinGraphGetResultsPaged', + 'PrivateLinkResourcePaged', + 'PrivateEndpointConnectionPaged', + 'DatabaseAccountKind', + 'DatabaseAccountOfferType', + 'DefaultConsistencyLevel', + 'ConnectorOffer', + 'IndexingMode', + 'DataType', + 'IndexKind', + 'PartitionKind', + 'ConflictResolutionMode', + 'TriggerType', + 'TriggerOperation', + 'KeyKind', + 'UnitType', + 'PrimaryAggregationType', +] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_cosmos_db_enums.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_cosmos_db_enums.py new file mode 100644 index 000000000000..0386fbe056dc --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_cosmos_db_enums.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class DatabaseAccountKind(str, Enum): + + global_document_db = "GlobalDocumentDB" + mongo_db = "MongoDB" + parse = "Parse" + + +class DatabaseAccountOfferType(str, Enum): + + standard = "Standard" + + +class DefaultConsistencyLevel(str, Enum): + + eventual = "Eventual" + session = "Session" + bounded_staleness = "BoundedStaleness" + strong = "Strong" + consistent_prefix = "ConsistentPrefix" + + +class ConnectorOffer(str, Enum): + + small = "Small" + + +class IndexingMode(str, Enum): + + consistent = "Consistent" + lazy = "Lazy" + none = "None" + + +class DataType(str, Enum): + + string = "String" + number = "Number" + point = "Point" + polygon = "Polygon" + line_string = "LineString" + multi_polygon = "MultiPolygon" + + +class IndexKind(str, Enum): + + hash = "Hash" + range = "Range" + spatial = "Spatial" + + +class PartitionKind(str, Enum): + + hash = "Hash" + range = "Range" + + +class ConflictResolutionMode(str, Enum): + + last_writer_wins = "LastWriterWins" + custom = "Custom" + + +class TriggerType(str, Enum): + + pre = "Pre" + post = "Post" + + +class TriggerOperation(str, Enum): + + all = "All" + create = "Create" + update = "Update" + delete = "Delete" + replace = "Replace" + + +class KeyKind(str, Enum): + + primary = "primary" + secondary = "secondary" + primary_readonly = "primaryReadonly" + secondary_readonly = "secondaryReadonly" + + +class UnitType(str, Enum): + + count = "Count" + bytes = "Bytes" + seconds = "Seconds" + percent = "Percent" + count_per_second = "CountPerSecond" + bytes_per_second = "BytesPerSecond" + milliseconds = "Milliseconds" + + +class PrimaryAggregationType(str, Enum): + + none = "None" + average = "Average" + total = "Total" + minimum = "Minimum" + maximum = "Maximum" + last = "Last" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_models.py new file mode 100644 index 000000000000..28b10c39fdb4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_models.py @@ -0,0 +1,4003 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ARMProxyResource(Model): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ARMProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ARMResourceProperties(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ARMResourceProperties, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class Resource(Model): + """Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AzureEntityResource(Resource): + """The resource model definition for a Azure Resource Manager resource with an + etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class Capability(Model): + """Cosmos DB capability object. + + :param name: Name of the Cosmos DB capability. For example, "name": + "EnableCassandra". Current values also include "EnableTable" and + "EnableGremlin". + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Capability, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Cassandra + keyspace + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraKeyspaceResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class CassandraKeyspaceGetResults(ARMResourceProperties): + """An Azure Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_keyspace_get_results_id: Required. Name of the Cosmos DB + Cassandra keyspace + :type cassandra_keyspace_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_keyspace_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_keyspace_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceGetResults, self).__init__(**kwargs) + self.cassandra_keyspace_get_results_id = kwargs.get('cassandra_keyspace_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + + +class CassandraKeyspaceResource(Model): + """Cosmos DB Cassandra keyspace resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra keyspace + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class CassandraPartitionKey(Model): + """Cosmos DB Cassandra table partition key. + + :param name: Name of the Cosmos DB Cassandra table partition key + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraPartitionKey, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class CassandraSchema(Model): + """Cosmos DB Cassandra table schema. + + :param columns: List of Cassandra table columns. + :type columns: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Column] + :param partition_keys: List of partition key. + :type partition_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraPartitionKey] + :param cluster_keys: List of cluster key. + :type cluster_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ClusterKey] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'partition_keys': {'key': 'partitionKeys', 'type': '[CassandraPartitionKey]'}, + 'cluster_keys': {'key': 'clusterKeys', 'type': '[ClusterKey]'}, + } + + def __init__(self, **kwargs): + super(CassandraSchema, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + self.partition_keys = kwargs.get('partition_keys', None) + self.cluster_keys = kwargs.get('cluster_keys', None) + + +class CassandraTableCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraTableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class CassandraTableGetResults(ARMResourceProperties): + """An Azure Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_table_get_results_id: Required. Name of the Cosmos DB + Cassandra table + :type cassandra_table_get_results_id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraSchema + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_table_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_table_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'schema': {'key': 'properties.schema', 'type': 'CassandraSchema'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraTableGetResults, self).__init__(**kwargs) + self.cassandra_table_get_results_id = kwargs.get('cassandra_table_get_results_id', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.schema = kwargs.get('schema', None) + self._rid = None + self._ts = None + self._etag = None + + +class CassandraTableResource(Model): + """Cosmos DB Cassandra table resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra table + :type id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraSchema + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, **kwargs): + super(CassandraTableResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.schema = kwargs.get('schema', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ClusterKey(Model): + """Cosmos DB Cassandra table cluster key. + + :param name: Name of the Cosmos DB Cassandra table cluster key + :type name: str + :param order_by: Order of the Cosmos DB Cassandra table cluster key, only + support "Asc" and "Desc" + :type order_by: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'order_by': {'key': 'orderBy', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ClusterKey, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.order_by = kwargs.get('order_by', None) + + +class Column(Model): + """Cosmos DB Cassandra table column. + + :param name: Name of the Cosmos DB Cassandra table column + :type name: str + :param type: Type of the Cosmos DB Cassandra table column + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Column, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class ConflictResolutionPolicy(Model): + """The conflict resolution policy for the container. + + :param mode: Indicates the conflict resolution mode. Possible values + include: 'LastWriterWins', 'Custom'. Default value: "LastWriterWins" . + :type mode: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionMode + :param conflict_resolution_path: The conflict resolution path in the case + of LastWriterWins mode. + :type conflict_resolution_path: str + :param conflict_resolution_procedure: The procedure to resolve conflicts + in the case of custom mode. + :type conflict_resolution_procedure: str + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, + 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ConflictResolutionPolicy, self).__init__(**kwargs) + self.mode = kwargs.get('mode', "LastWriterWins") + self.conflict_resolution_path = kwargs.get('conflict_resolution_path', None) + self.conflict_resolution_procedure = kwargs.get('conflict_resolution_procedure', None) + + +class ConsistencyPolicy(Model): + """The consistency policy for the Cosmos DB database account. + + All required parameters must be populated in order to send to Azure. + + :param default_consistency_level: Required. The default consistency level + and configuration settings of the Cosmos DB account. Possible values + include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', + 'ConsistentPrefix' + :type default_consistency_level: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DefaultConsistencyLevel + :param max_staleness_prefix: When used with the Bounded Staleness + consistency level, this value represents the number of stale requests + tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_staleness_prefix: long + :param max_interval_in_seconds: When used with the Bounded Staleness + consistency level, this value represents the time amount of staleness (in + seconds) tolerated. Accepted range for this value is 5 - 86400. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_interval_in_seconds: int + """ + + _validation = { + 'default_consistency_level': {'required': True}, + 'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1}, + 'max_interval_in_seconds': {'maximum': 86400, 'minimum': 5}, + } + + _attribute_map = { + 'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'DefaultConsistencyLevel'}, + 'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'}, + 'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ConsistencyPolicy, self).__init__(**kwargs) + self.default_consistency_level = kwargs.get('default_consistency_level', None) + self.max_staleness_prefix = kwargs.get('max_staleness_prefix', None) + self.max_interval_in_seconds = kwargs.get('max_interval_in_seconds', None) + + +class ContainerPartitionKey(Model): + """The configuration of the partition key to be used for partitioning data + into multiple partitions. + + :param paths: List of paths using which data within the container can be + partitioned + :type paths: list[str] + :param kind: Indicates the kind of algorithm used for partitioning. + Possible values include: 'Hash', 'Range'. Default value: "Hash" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionKind + :param version: Indicates the version of the partition key definition + :type version: int + """ + + _validation = { + 'version': {'maximum': 2, 'minimum': 1}, + } + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ContainerPartitionKey, self).__init__(**kwargs) + self.paths = kwargs.get('paths', None) + self.kind = kwargs.get('kind', "Hash") + self.version = kwargs.get('version', None) + + +class DatabaseAccountConnectionString(Model): + """Connection string for the Cosmos DB account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar connection_string: Value of the connection string + :vartype connection_string: str + :ivar description: Description of the connection string + :vartype description: str + """ + + _validation = { + 'connection_string': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountConnectionString, self).__init__(**kwargs) + self.connection_string = None + self.description = None + + +class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB database accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountKind + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConsistencyPolicy + :param locations: Required. An array that contains the georeplication + locations enabled for the Cosmos DB account. + :type locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :ivar database_account_offer_type: Required. The offer type for the + database. Default value: "Standard" . + :vartype database_account_offer_type: str + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + database_account_offer_type = "Standard" + + def __init__(self, **kwargs): + super(DatabaseAccountCreateUpdateParameters, self).__init__(**kwargs) + self.kind = kwargs.get('kind', "GlobalDocumentDB") + self.consistency_policy = kwargs.get('consistency_policy', None) + self.locations = kwargs.get('locations', None) + self.ip_range_filter = kwargs.get('ip_range_filter', None) + self.is_virtual_network_filter_enabled = kwargs.get('is_virtual_network_filter_enabled', None) + self.enable_automatic_failover = kwargs.get('enable_automatic_failover', None) + self.capabilities = kwargs.get('capabilities', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.enable_multiple_write_locations = kwargs.get('enable_multiple_write_locations', None) + self.enable_cassandra_connector = kwargs.get('enable_cassandra_connector', None) + self.connector_offer = kwargs.get('connector_offer', None) + self.disable_key_based_metadata_write_access = kwargs.get('disable_key_based_metadata_write_access', None) + + +class DatabaseAccountGetResults(ARMResourceProperties): + """An Azure Cosmos DB database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountKind + :param provisioning_state: + :type provisioning_state: str + :ivar document_endpoint: The connection endpoint for the Cosmos DB + database account. + :vartype document_endpoint: str + :ivar database_account_offer_type: The offer type for the Cosmos DB + database account. Default value: Standard. Possible values include: + 'Standard' + :vartype database_account_offer_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountOfferType + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param consistency_policy: The consistency policy for the Cosmos DB + database account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConsistencyPolicy + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Capability] + :ivar write_locations: An array that contains the write location for the + Cosmos DB account. + :vartype write_locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :ivar read_locations: An array that contains of the read locations enabled + for the Cosmos DB account. + :vartype read_locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :ivar locations: An array that contains all of the locations enabled for + the Cosmos DB account. + :vartype locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :ivar failover_policies: An array that contains the regions ordered by + their failover priorities. + :vartype failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.FailoverPolicy] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'database_account_offer_type': {'readonly': True}, + 'write_locations': {'readonly': True}, + 'read_locations': {'readonly': True}, + 'locations': {'readonly': True}, + 'failover_policies': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'DatabaseAccountOfferType'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'}, + 'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountGetResults, self).__init__(**kwargs) + self.kind = kwargs.get('kind', "GlobalDocumentDB") + self.provisioning_state = kwargs.get('provisioning_state', None) + self.document_endpoint = None + self.database_account_offer_type = None + self.ip_range_filter = kwargs.get('ip_range_filter', None) + self.is_virtual_network_filter_enabled = kwargs.get('is_virtual_network_filter_enabled', None) + self.enable_automatic_failover = kwargs.get('enable_automatic_failover', None) + self.consistency_policy = kwargs.get('consistency_policy', None) + self.capabilities = kwargs.get('capabilities', None) + self.write_locations = None + self.read_locations = None + self.locations = None + self.failover_policies = None + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.enable_multiple_write_locations = kwargs.get('enable_multiple_write_locations', None) + self.enable_cassandra_connector = kwargs.get('enable_cassandra_connector', None) + self.connector_offer = kwargs.get('connector_offer', None) + self.disable_key_based_metadata_write_access = kwargs.get('disable_key_based_metadata_write_access', None) + + +class DatabaseAccountListConnectionStringsResult(Model): + """The connection strings for the given database account. + + :param connection_strings: An array that contains the connection strings + for the Cosmos DB account. + :type connection_strings: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountConnectionString] + """ + + _attribute_map = { + 'connection_strings': {'key': 'connectionStrings', 'type': '[DatabaseAccountConnectionString]'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountListConnectionStringsResult, self).__init__(**kwargs) + self.connection_strings = kwargs.get('connection_strings', None) + + +class DatabaseAccountListReadOnlyKeysResult(Model): + """The read-only access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountListReadOnlyKeysResult, self).__init__(**kwargs) + self.primary_readonly_master_key = None + self.secondary_readonly_master_key = None + + +class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): + """The access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + :ivar primary_master_key: Base 64 encoded value of the primary read-write + key. + :vartype primary_master_key: str + :ivar secondary_master_key: Base 64 encoded value of the secondary + read-write key. + :vartype secondary_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + 'primary_master_key': {'readonly': True}, + 'secondary_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + 'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'}, + 'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountListKeysResult, self).__init__(**kwargs) + self.primary_master_key = None + self.secondary_master_key = None + + +class DatabaseAccountRegenerateKeyParameters(Model): + """Parameters to regenerate the keys within the database account. + + All required parameters must be populated in order to send to Azure. + + :param key_kind: Required. The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + :type key_kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.KeyKind + """ + + _validation = { + 'key_kind': {'required': True}, + } + + _attribute_map = { + 'key_kind': {'key': 'keyKind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountRegenerateKeyParameters, self).__init__(**kwargs) + self.key_kind = kwargs.get('key_kind', None) + + +class DatabaseAccountUpdateParameters(Model): + """Parameters for patching Azure Cosmos DB database account properties. + + :param tags: + :type tags: dict[str, str] + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConsistencyPolicy + :param locations: An array that contains the georeplication locations + enabled for the Cosmos DB account. + :type locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(DatabaseAccountUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + self.consistency_policy = kwargs.get('consistency_policy', None) + self.locations = kwargs.get('locations', None) + self.ip_range_filter = kwargs.get('ip_range_filter', None) + self.is_virtual_network_filter_enabled = kwargs.get('is_virtual_network_filter_enabled', None) + self.enable_automatic_failover = kwargs.get('enable_automatic_failover', None) + self.capabilities = kwargs.get('capabilities', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.enable_multiple_write_locations = kwargs.get('enable_multiple_write_locations', None) + self.enable_cassandra_connector = kwargs.get('enable_cassandra_connector', None) + self.connector_offer = kwargs.get('connector_offer', None) + self.disable_key_based_metadata_write_access = kwargs.get('disable_key_based_metadata_write_access', None) + + +class ErrorResponse(Model): + """Error Response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ExcludedPath(Model): + """ExcludedPath. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExcludedPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + + +class ExtendedResourceProperties(Model): + """The system generated resource properties associated with SQL databases, SQL + containers, Gremlin databases and Gremlin graphs. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + '_rid': {'key': '_rid', 'type': 'str'}, + '_ts': {'key': '_ts', 'type': 'object'}, + '_etag': {'key': '_etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExtendedResourceProperties, self).__init__(**kwargs) + self._rid = None + self._ts = None + self._etag = None + + +class FailoverPolicies(Model): + """The list of new failover policies for the failover priority change. + + All required parameters must be populated in order to send to Azure. + + :param failover_policies: Required. List of failover policies. + :type failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.FailoverPolicy] + """ + + _validation = { + 'failover_policies': {'required': True}, + } + + _attribute_map = { + 'failover_policies': {'key': 'failoverPolicies', 'type': '[FailoverPolicy]'}, + } + + def __init__(self, **kwargs): + super(FailoverPolicies, self).__init__(**kwargs) + self.failover_policies = kwargs.get('failover_policies', None) + + +class FailoverPolicy(Model): + """The failover policy for a given region of a database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region in which the database + account replicates to. Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region in which the database account + exists. + :type location_name: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + """ + + _validation = { + 'id': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(FailoverPolicy, self).__init__(**kwargs) + self.id = None + self.location_name = kwargs.get('location_name', None) + self.failover_priority = kwargs.get('failover_priority', None) + + +class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class GremlinDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_database_get_results_id: Required. Name of the Cosmos DB + Gremlin database + :type gremlin_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseGetResults, self).__init__(**kwargs) + self.gremlin_database_get_results_id = kwargs.get('gremlin_database_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + + +class GremlinDatabaseResource(Model): + """Cosmos DB Gremlin database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class GremlinGraphCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Gremlin graph + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinGraphResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(GremlinGraphCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class GremlinGraphGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_graph_get_results_id: Required. Name of the Cosmos DB + Gremlin graph + :type gremlin_graph_get_results_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionPolicy + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_graph_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_graph_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinGraphGetResults, self).__init__(**kwargs) + self.gremlin_graph_get_results_id = kwargs.get('gremlin_graph_get_results_id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + self._rid = None + self._ts = None + self._etag = None + + +class GremlinGraphResource(Model): + """Cosmos DB Gremlin graph resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin graph + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, **kwargs): + super(GremlinGraphResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + + +class IncludedPath(Model): + """The paths that are included in indexing. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + :param indexes: List of indexes for this path + :type indexes: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Indexes] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, + } + + def __init__(self, **kwargs): + super(IncludedPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.indexes = kwargs.get('indexes', None) + + +class Indexes(Model): + """The indexes for the path. + + :param data_type: The datatype for which the indexing behavior is applied + to. Possible values include: 'String', 'Number', 'Point', 'Polygon', + 'LineString', 'MultiPolygon'. Default value: "String" . + :type data_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DataType + :param precision: The precision of the index. -1 is maximum precision. + :type precision: int + :param kind: Indicates the type of index. Possible values include: 'Hash', + 'Range', 'Spatial'. Default value: "Hash" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexKind + """ + + _attribute_map = { + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'precision': {'key': 'precision', 'type': 'int'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Indexes, self).__init__(**kwargs) + self.data_type = kwargs.get('data_type', "String") + self.precision = kwargs.get('precision', None) + self.kind = kwargs.get('kind', "Hash") + + +class IndexingPolicy(Model): + """Cosmos DB indexing policy. + + :param automatic: Indicates if the indexing policy is automatic + :type automatic: bool + :param indexing_mode: Indicates the indexing mode. Possible values + include: 'Consistent', 'Lazy', 'None'. Default value: "Consistent" . + :type indexing_mode: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingMode + :param included_paths: List of paths to include in the indexing + :type included_paths: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IncludedPath] + :param excluded_paths: List of paths to exclude from indexing + :type excluded_paths: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ExcludedPath] + """ + + _attribute_map = { + 'automatic': {'key': 'automatic', 'type': 'bool'}, + 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, + 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, + } + + def __init__(self, **kwargs): + super(IndexingPolicy, self).__init__(**kwargs) + self.automatic = kwargs.get('automatic', None) + self.indexing_mode = kwargs.get('indexing_mode', "Consistent") + self.included_paths = kwargs.get('included_paths', None) + self.excluded_paths = kwargs.get('excluded_paths', None) + + +class Location(Model): + """A region in which the Azure Cosmos DB database account is deployed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region within the database account. + Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region. + :type location_name: str + :ivar document_endpoint: The connection endpoint for the specific region. + Example: + https://<accountName>-<locationName>.documents.azure.com:443/ + :vartype document_endpoint: str + :param provisioning_state: + :type provisioning_state: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + :param is_zone_redundant: Flag to indicate whether or not this region is + an AvailabilityZone region + :type is_zone_redundant: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'document_endpoint': {'key': 'documentEndpoint', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + 'is_zone_redundant': {'key': 'isZoneRedundant', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(Location, self).__init__(**kwargs) + self.id = None + self.location_name = kwargs.get('location_name', None) + self.document_endpoint = None + self.provisioning_state = kwargs.get('provisioning_state', None) + self.failover_priority = kwargs.get('failover_priority', None) + self.is_zone_redundant = kwargs.get('is_zone_redundant', None) + + +class Metric(Model): + """Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + } + + def __init__(self, **kwargs): + super(Metric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = kwargs.get('unit', None) + self.name = None + self.metric_values = None + + +class MetricAvailability(Model): + """The availability of the metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :ivar retention: The retention for the metric values. + :vartype retention: str + """ + + _validation = { + 'time_grain': {'readonly': True}, + 'retention': {'readonly': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'retention': {'key': 'retention', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = None + self.retention = None + + +class MetricDefinition(Model): + """The definition of a metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar metric_availabilities: The list of metric availabilities for the + account. + :vartype metric_availabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricAvailability] + :ivar primary_aggregation_type: The primary aggregation type of the + metric. Possible values include: 'None', 'Average', 'Total', 'Minimum', + 'Maximum', 'Last' + :vartype primary_aggregation_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrimaryAggregationType + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar resource_uri: The resource uri of the database. + :vartype resource_uri: str + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + """ + + _validation = { + 'metric_availabilities': {'readonly': True}, + 'primary_aggregation_type': {'readonly': True}, + 'resource_uri': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + } + + def __init__(self, **kwargs): + super(MetricDefinition, self).__init__(**kwargs) + self.metric_availabilities = None + self.primary_aggregation_type = None + self.unit = kwargs.get('unit', None) + self.resource_uri = None + self.name = None + + +class MetricName(Model): + """A metric name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The name of the metric. + :vartype value: str + :ivar localized_value: The friendly name of the metric. + :vartype localized_value: str + """ + + _validation = { + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricName, self).__init__(**kwargs) + self.value = None + self.localized_value = None + + +class MetricValue(Model): + """Represents metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(MetricValue, self).__init__(**kwargs) + self._count = None + self.average = None + self.maximum = None + self.minimum = None + self.timestamp = None + self.total = None + + +class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a MongoDB + collection + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBCollectionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MongoDBCollectionCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class MongoDBCollectionGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_collection_get_results_id: Required. Name of the Cosmos DB + MongoDB collection + :type mongo_db_collection_get_results_id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoIndex] + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_collection_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_collection_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'shard_key': {'key': 'properties.shardKey', 'type': '{str}'}, + 'indexes': {'key': 'properties.indexes', 'type': '[MongoIndex]'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDBCollectionGetResults, self).__init__(**kwargs) + self.mongo_db_collection_get_results_id = kwargs.get('mongo_db_collection_get_results_id', None) + self.shard_key = kwargs.get('shard_key', None) + self.indexes = kwargs.get('indexes', None) + self._rid = None + self._ts = None + self._etag = None + + +class MongoDBCollectionResource(Model): + """Cosmos DB MongoDB collection resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB collection + :type id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoIndex] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, **kwargs): + super(MongoDBCollectionResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.shard_key = kwargs.get('shard_key', None) + self.indexes = kwargs.get('indexes', None) + + +class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a MongoDB database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MongoDBDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class MongoDBDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_database_get_results_id: Required. Name of the Cosmos DB + MongoDB database + :type mongo_db_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDBDatabaseGetResults, self).__init__(**kwargs) + self.mongo_db_database_get_results_id = kwargs.get('mongo_db_database_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + + +class MongoDBDatabaseResource(Model): + """Cosmos DB MongoDB database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDBDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class MongoIndex(Model): + """Cosmos DB MongoDB collection index key. + + :param key: Cosmos DB MongoDB collection index keys + :type key: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoIndexKeys + :param options: Cosmos DB MongoDB collection index key options + :type options: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoIndexOptions + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, + 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, + } + + def __init__(self, **kwargs): + super(MongoIndex, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.options = kwargs.get('options', None) + + +class MongoIndexKeys(Model): + """Cosmos DB MongoDB collection resource object. + + :param keys: List of keys for each MongoDB collection in the Azure Cosmos + DB service + :type keys: list[str] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MongoIndexKeys, self).__init__(**kwargs) + self.keys = kwargs.get('keys', None) + + +class MongoIndexOptions(Model): + """Cosmos DB MongoDB collection index options. + + :param expire_after_seconds: Expire after seconds + :type expire_after_seconds: int + :param unique: Is unique or not + :type unique: bool + """ + + _attribute_map = { + 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, + 'unique': {'key': 'unique', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(MongoIndexOptions, self).__init__(**kwargs) + self.expire_after_seconds = kwargs.get('expire_after_seconds', None) + self.unique = kwargs.get('unique', None) + + +class Operation(Model): + """REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ResourceProvider + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'Provider', 'type': 'str'}, + 'resource': {'key': 'Resource', 'type': 'str'}, + 'operation': {'key': 'Operation', 'type': 'str'}, + 'description': {'key': 'Description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class PartitionMetric(Metric): + """The metric values for a single partition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricValue] + :ivar partition_id: The partition id (GUID identifier) of the metric + values. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the metric values. + :vartype partition_key_range_id: str + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PartitionMetric, self).__init__(**kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class Usage(Model): + """The usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(Usage, self).__init__(**kwargs) + self.unit = kwargs.get('unit', None) + self.name = None + self.quota_period = None + self.limit = None + self.current_value = None + + +class PartitionUsage(Usage): + """The partition level usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + :ivar partition_id: The partition id (GUID identifier) of the usages. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the usages. + :vartype partition_key_range_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PartitionUsage, self).__init__(**kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class PercentileMetric(Model): + """Percentile Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar metric_values: The percentile metric values for the specified time + window and timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PercentileMetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[PercentileMetricValue]'}, + } + + def __init__(self, **kwargs): + super(PercentileMetric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = kwargs.get('unit', None) + self.name = None + self.metric_values = None + + +class PercentileMetricValue(MetricValue): + """Represents percentile metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + :ivar p10: The 10th percentile value for the metric. + :vartype p10: float + :ivar p25: The 25th percentile value for the metric. + :vartype p25: float + :ivar p50: The 50th percentile value for the metric. + :vartype p50: float + :ivar p75: The 75th percentile value for the metric. + :vartype p75: float + :ivar p90: The 90th percentile value for the metric. + :vartype p90: float + :ivar p95: The 95th percentile value for the metric. + :vartype p95: float + :ivar p99: The 99th percentile value for the metric. + :vartype p99: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + 'p10': {'readonly': True}, + 'p25': {'readonly': True}, + 'p50': {'readonly': True}, + 'p75': {'readonly': True}, + 'p90': {'readonly': True}, + 'p95': {'readonly': True}, + 'p99': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + 'p10': {'key': 'P10', 'type': 'float'}, + 'p25': {'key': 'P25', 'type': 'float'}, + 'p50': {'key': 'P50', 'type': 'float'}, + 'p75': {'key': 'P75', 'type': 'float'}, + 'p90': {'key': 'P90', 'type': 'float'}, + 'p95': {'key': 'P95', 'type': 'float'}, + 'p99': {'key': 'P99', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(PercentileMetricValue, self).__init__(**kwargs) + self.p10 = None + self.p25 = None + self.p50 = None + self.p75 = None + self.p90 = None + self.p95 = None + self.p99 = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) + + +class PrivateEndpointConnection(ProxyResource): + """A private endpoint connection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param private_endpoint: Private endpoint which the connection belongs to. + :type private_endpoint: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateEndpointProperty + :param private_link_service_connection_state: Connection State of the + Private Endpoint Connection. + :type private_link_service_connection_state: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateLinkServiceConnectionStateProperty + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + + +class PrivateEndpointProperty(Model): + """Private endpoint which the connection belongs to. + + :param id: Resource id of the private endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpointProperty, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class PrivateLinkResource(ARMProxyResource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + + +class PrivateLinkServiceConnectionStateProperty(Model): + """Connection State of the Private Endpoint Connection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param status: The private link service connection status. + :type status: str + :param description: The private link service connection description. + :type description: str + :ivar actions_required: Any action that is required beyond basic workflow + (approve/ reject/ disconnect) + :vartype actions_required: str + """ + + _validation = { + 'actions_required': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = None + + +class RegionForOnlineOffline(Model): + """Cosmos DB region to online or offline. + + All required parameters must be populated in order to send to Azure. + + :param region: Required. Cosmos DB region, with spaces between words and + each word capitalized. + :type region: str + """ + + _validation = { + 'region': {'required': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegionForOnlineOffline, self).__init__(**kwargs) + self.region = kwargs.get('region', None) + + +class SqlContainerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a container + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlContainerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlContainerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlContainerCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlContainerGetResults(ARMResourceProperties): + """An Azure Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_container_get_results_id: Required. Name of the Cosmos DB SQL + container + :type sql_container_get_results_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionPolicy + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_container_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_container_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlContainerGetResults, self).__init__(**kwargs) + self.sql_container_get_results_id = kwargs.get('sql_container_get_results_id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + self._rid = None + self._ts = None + self._etag = None + + +class SqlContainerResource(Model): + """Cosmos DB SQL container resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL container + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, **kwargs): + super(SqlContainerResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + + +class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a SQL database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_database_get_results_id: Required. Name of the Cosmos DB SQL + database + :type sql_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + :param _colls: A system generated property that specified the addressable + path of the collections resource. + :type _colls: str + :param _users: A system generated property that specifies the addressable + path of the users resource. + :type _users: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + '_colls': {'key': 'properties._colls', 'type': 'str'}, + '_users': {'key': 'properties._users', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseGetResults, self).__init__(**kwargs) + self.sql_database_get_results_id = kwargs.get('sql_database_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + self._colls = kwargs.get('_colls', None) + self._users = kwargs.get('_users', None) + + +class SqlDatabaseResource(Model): + """Cosmos DB SQL database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB storedProcedure. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a storedProcedure + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlStoredProcedureResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlStoredProcedureResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlStoredProcedureCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlStoredProcedureGetResults(ARMResourceProperties): + """An Azure Cosmos DB storedProcedure. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_stored_procedure_get_results_id: Required. Name of the Cosmos + DB SQL storedProcedure + :type sql_stored_procedure_get_results_id: str + :param body: Body of the Stored Procedure + :type body: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_stored_procedure_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_stored_procedure_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlStoredProcedureGetResults, self).__init__(**kwargs) + self.sql_stored_procedure_get_results_id = kwargs.get('sql_stored_procedure_get_results_id', None) + self.body = kwargs.get('body', None) + self._rid = None + self._ts = None + self._etag = None + + +class SqlStoredProcedureResource(Model): + """Cosmos DB SQL storedProcedure resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL storedProcedure + :type id: str + :param body: Body of the Stored Procedure + :type body: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlStoredProcedureResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.body = kwargs.get('body', None) + + +class SqlTriggerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB trigger. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a trigger + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlTriggerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlTriggerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlTriggerCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlTriggerGetResults(ARMResourceProperties): + """An Azure Cosmos DB trigger. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_trigger_get_results_id: Required. Name of the Cosmos DB SQL + trigger + :type sql_trigger_get_results_id: str + :param body: Body of the Trigger + :type body: str + :param trigger_type: Type of the Trigger. Possible values include: 'Pre', + 'Post' + :type trigger_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TriggerType + :param trigger_operation: The operation the trigger is associated with. + Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' + :type trigger_operation: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TriggerOperation + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_trigger_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_trigger_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + 'trigger_type': {'key': 'properties.triggerType', 'type': 'str'}, + 'trigger_operation': {'key': 'properties.triggerOperation', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlTriggerGetResults, self).__init__(**kwargs) + self.sql_trigger_get_results_id = kwargs.get('sql_trigger_get_results_id', None) + self.body = kwargs.get('body', None) + self.trigger_type = kwargs.get('trigger_type', None) + self.trigger_operation = kwargs.get('trigger_operation', None) + self._rid = None + self._ts = None + self._etag = None + + +class SqlTriggerResource(Model): + """Cosmos DB SQL trigger resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL trigger + :type id: str + :param body: Body of the Trigger + :type body: str + :param trigger_type: Type of the Trigger. Possible values include: 'Pre', + 'Post' + :type trigger_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TriggerType + :param trigger_operation: The operation the trigger is associated with. + Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' + :type trigger_operation: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TriggerOperation + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + 'trigger_type': {'key': 'triggerType', 'type': 'str'}, + 'trigger_operation': {'key': 'triggerOperation', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlTriggerResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.body = kwargs.get('body', None) + self.trigger_type = kwargs.get('trigger_type', None) + self.trigger_operation = kwargs.get('trigger_operation', None) + + +class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB userDefinedFunction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a + userDefinedFunction + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlUserDefinedFunctionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlUserDefinedFunctionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlUserDefinedFunctionCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class SqlUserDefinedFunctionGetResults(ARMResourceProperties): + """An Azure Cosmos DB userDefinedFunction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_user_defined_function_get_results_id: Required. Name of the + Cosmos DB SQL userDefinedFunction + :type sql_user_defined_function_get_results_id: str + :param body: Body of the User Defined Function + :type body: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_user_defined_function_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_user_defined_function_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlUserDefinedFunctionGetResults, self).__init__(**kwargs) + self.sql_user_defined_function_get_results_id = kwargs.get('sql_user_defined_function_get_results_id', None) + self.body = kwargs.get('body', None) + self._rid = None + self._ts = None + self._etag = None + + +class SqlUserDefinedFunctionResource(Model): + """Cosmos DB SQL userDefinedFunction resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL userDefinedFunction + :type id: str + :param body: Body of the User Defined Function + :type body: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlUserDefinedFunctionResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.body = kwargs.get('body', None) + + +class TableCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Table + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'TableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) + + +class TableGetResults(ARMResourceProperties): + """An Azure Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param table_get_results_id: Required. Name of the Cosmos DB table + :type table_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'table_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'table_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TableGetResults, self).__init__(**kwargs) + self.table_get_results_id = kwargs.get('table_get_results_id', None) + self._rid = None + self._ts = None + self._etag = None + + +class TableResource(Model): + """Cosmos DB table resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB table + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TableResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class ThroughputSettingsGetResults(ARMResourceProperties): + """An Azure Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + :ivar minimum_throughput: The minimum throughput of the resource + :vartype minimum_throughput: str + :ivar offer_replace_pending: The throughput replace is pending + :vartype offer_replace_pending: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'throughput': {'key': 'properties.throughput', 'type': 'int'}, + 'minimum_throughput': {'key': 'properties.minimumThroughput', 'type': 'str'}, + 'offer_replace_pending': {'key': 'properties.offerReplacePending', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ThroughputSettingsGetResults, self).__init__(**kwargs) + self.throughput = kwargs.get('throughput', None) + self.minimum_throughput = None + self.offer_replace_pending = None + + +class ThroughputSettingsResource(Model): + """Cosmos DB resource throughput object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + :ivar minimum_throughput: The minimum throughput of the resource + :vartype minimum_throughput: str + :ivar offer_replace_pending: The throughput replace is pending + :vartype offer_replace_pending: str + """ + + _validation = { + 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, + } + + _attribute_map = { + 'throughput': {'key': 'throughput', 'type': 'int'}, + 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, + 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ThroughputSettingsResource, self).__init__(**kwargs) + self.throughput = kwargs.get('throughput', None) + self.minimum_throughput = None + self.offer_replace_pending = None + + +class ThroughputSettingsUpdateParameters(ARMResourceProperties): + """Parameters to update Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a resource + throughput + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsResource + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'ThroughputSettingsResource'}, + } + + def __init__(self, **kwargs): + super(ThroughputSettingsUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + + +class UniqueKey(Model): + """The unique key on that enforces uniqueness constraint on documents in the + collection in the Azure Cosmos DB service. + + :param paths: List of paths must be unique for each document in the Azure + Cosmos DB service + :type paths: list[str] + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UniqueKey, self).__init__(**kwargs) + self.paths = kwargs.get('paths', None) + + +class UniqueKeyPolicy(Model): + """The unique key policy configuration for specifying uniqueness constraints + on documents in the collection in the Azure Cosmos DB service. + + :param unique_keys: List of unique keys on that enforces uniqueness + constraint on documents in the collection in the Azure Cosmos DB service. + :type unique_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKey] + """ + + _attribute_map = { + 'unique_keys': {'key': 'uniqueKeys', 'type': '[UniqueKey]'}, + } + + def __init__(self, **kwargs): + super(UniqueKeyPolicy, self).__init__(**kwargs) + self.unique_keys = kwargs.get('unique_keys', None) + + +class VirtualNetworkRule(Model): + """Virtual Network ACL Rule object. + + :param id: Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :type id: str + :param ignore_missing_vnet_service_endpoint: Create firewall rule before + the virtual network has vnet service endpoint enabled. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVNetServiceEndpoint', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_models_py3.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..02fea71e2eb3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_models_py3.py @@ -0,0 +1,4003 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ARMProxyResource(Model): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ARMProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ARMResourceProperties(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + super(ARMResourceProperties, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class Resource(Model): + """Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AzureEntityResource(Resource): + """The resource model definition for a Azure Resource Manager resource with an + etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class Capability(Model): + """Cosmos DB capability object. + + :param name: Name of the Cosmos DB capability. For example, "name": + "EnableCassandra". Current values also include "EnableTable" and + "EnableGremlin". + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, **kwargs) -> None: + super(Capability, self).__init__(**kwargs) + self.name = name + + +class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Cassandra + keyspace + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraKeyspaceResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class CassandraKeyspaceGetResults(ARMResourceProperties): + """An Azure Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_keyspace_get_results_id: Required. Name of the Cosmos DB + Cassandra keyspace + :type cassandra_keyspace_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_keyspace_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_keyspace_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, cassandra_keyspace_get_results_id: str, location: str=None, tags=None, **kwargs) -> None: + super(CassandraKeyspaceGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.cassandra_keyspace_get_results_id = cassandra_keyspace_get_results_id + self._rid = None + self._ts = None + self._etag = None + + +class CassandraKeyspaceResource(Model): + """Cosmos DB Cassandra keyspace resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra keyspace + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(CassandraKeyspaceResource, self).__init__(**kwargs) + self.id = id + + +class CassandraPartitionKey(Model): + """Cosmos DB Cassandra table partition key. + + :param name: Name of the Cosmos DB Cassandra table partition key + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, **kwargs) -> None: + super(CassandraPartitionKey, self).__init__(**kwargs) + self.name = name + + +class CassandraSchema(Model): + """Cosmos DB Cassandra table schema. + + :param columns: List of Cassandra table columns. + :type columns: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Column] + :param partition_keys: List of partition key. + :type partition_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraPartitionKey] + :param cluster_keys: List of cluster key. + :type cluster_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ClusterKey] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'partition_keys': {'key': 'partitionKeys', 'type': '[CassandraPartitionKey]'}, + 'cluster_keys': {'key': 'clusterKeys', 'type': '[ClusterKey]'}, + } + + def __init__(self, *, columns=None, partition_keys=None, cluster_keys=None, **kwargs) -> None: + super(CassandraSchema, self).__init__(**kwargs) + self.columns = columns + self.partition_keys = partition_keys + self.cluster_keys = cluster_keys + + +class CassandraTableCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraTableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(CassandraTableCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class CassandraTableGetResults(ARMResourceProperties): + """An Azure Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param cassandra_table_get_results_id: Required. Name of the Cosmos DB + Cassandra table + :type cassandra_table_get_results_id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraSchema + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_table_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cassandra_table_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'schema': {'key': 'properties.schema', 'type': 'CassandraSchema'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, cassandra_table_get_results_id: str, location: str=None, tags=None, default_ttl: int=None, schema=None, **kwargs) -> None: + super(CassandraTableGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.cassandra_table_get_results_id = cassandra_table_get_results_id + self.default_ttl = default_ttl + self.schema = schema + self._rid = None + self._ts = None + self._etag = None + + +class CassandraTableResource(Model): + """Cosmos DB Cassandra table resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra table + :type id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraSchema + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, *, id: str, default_ttl: int=None, schema=None, **kwargs) -> None: + super(CassandraTableResource, self).__init__(**kwargs) + self.id = id + self.default_ttl = default_ttl + self.schema = schema + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ClusterKey(Model): + """Cosmos DB Cassandra table cluster key. + + :param name: Name of the Cosmos DB Cassandra table cluster key + :type name: str + :param order_by: Order of the Cosmos DB Cassandra table cluster key, only + support "Asc" and "Desc" + :type order_by: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'order_by': {'key': 'orderBy', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, order_by: str=None, **kwargs) -> None: + super(ClusterKey, self).__init__(**kwargs) + self.name = name + self.order_by = order_by + + +class Column(Model): + """Cosmos DB Cassandra table column. + + :param name: Name of the Cosmos DB Cassandra table column + :type name: str + :param type: Type of the Cosmos DB Cassandra table column + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, **kwargs) -> None: + super(Column, self).__init__(**kwargs) + self.name = name + self.type = type + + +class ConflictResolutionPolicy(Model): + """The conflict resolution policy for the container. + + :param mode: Indicates the conflict resolution mode. Possible values + include: 'LastWriterWins', 'Custom'. Default value: "LastWriterWins" . + :type mode: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionMode + :param conflict_resolution_path: The conflict resolution path in the case + of LastWriterWins mode. + :type conflict_resolution_path: str + :param conflict_resolution_procedure: The procedure to resolve conflicts + in the case of custom mode. + :type conflict_resolution_procedure: str + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, + 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, + } + + def __init__(self, *, mode="LastWriterWins", conflict_resolution_path: str=None, conflict_resolution_procedure: str=None, **kwargs) -> None: + super(ConflictResolutionPolicy, self).__init__(**kwargs) + self.mode = mode + self.conflict_resolution_path = conflict_resolution_path + self.conflict_resolution_procedure = conflict_resolution_procedure + + +class ConsistencyPolicy(Model): + """The consistency policy for the Cosmos DB database account. + + All required parameters must be populated in order to send to Azure. + + :param default_consistency_level: Required. The default consistency level + and configuration settings of the Cosmos DB account. Possible values + include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', + 'ConsistentPrefix' + :type default_consistency_level: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DefaultConsistencyLevel + :param max_staleness_prefix: When used with the Bounded Staleness + consistency level, this value represents the number of stale requests + tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_staleness_prefix: long + :param max_interval_in_seconds: When used with the Bounded Staleness + consistency level, this value represents the time amount of staleness (in + seconds) tolerated. Accepted range for this value is 5 - 86400. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_interval_in_seconds: int + """ + + _validation = { + 'default_consistency_level': {'required': True}, + 'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1}, + 'max_interval_in_seconds': {'maximum': 86400, 'minimum': 5}, + } + + _attribute_map = { + 'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'DefaultConsistencyLevel'}, + 'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'}, + 'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'}, + } + + def __init__(self, *, default_consistency_level, max_staleness_prefix: int=None, max_interval_in_seconds: int=None, **kwargs) -> None: + super(ConsistencyPolicy, self).__init__(**kwargs) + self.default_consistency_level = default_consistency_level + self.max_staleness_prefix = max_staleness_prefix + self.max_interval_in_seconds = max_interval_in_seconds + + +class ContainerPartitionKey(Model): + """The configuration of the partition key to be used for partitioning data + into multiple partitions. + + :param paths: List of paths using which data within the container can be + partitioned + :type paths: list[str] + :param kind: Indicates the kind of algorithm used for partitioning. + Possible values include: 'Hash', 'Range'. Default value: "Hash" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionKind + :param version: Indicates the version of the partition key definition + :type version: int + """ + + _validation = { + 'version': {'maximum': 2, 'minimum': 1}, + } + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'int'}, + } + + def __init__(self, *, paths=None, kind="Hash", version: int=None, **kwargs) -> None: + super(ContainerPartitionKey, self).__init__(**kwargs) + self.paths = paths + self.kind = kind + self.version = version + + +class DatabaseAccountConnectionString(Model): + """Connection string for the Cosmos DB account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar connection_string: Value of the connection string + :vartype connection_string: str + :ivar description: Description of the connection string + :vartype description: str + """ + + _validation = { + 'connection_string': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DatabaseAccountConnectionString, self).__init__(**kwargs) + self.connection_string = None + self.description = None + + +class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB database accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountKind + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConsistencyPolicy + :param locations: Required. An array that contains the georeplication + locations enabled for the Cosmos DB account. + :type locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :ivar database_account_offer_type: Required. The offer type for the + database. Default value: "Standard" . + :vartype database_account_offer_type: str + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + database_account_offer_type = "Standard" + + def __init__(self, *, locations, location: str=None, tags=None, kind="GlobalDocumentDB", consistency_policy=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, enable_cassandra_connector: bool=None, connector_offer=None, disable_key_based_metadata_write_access: bool=None, **kwargs) -> None: + super(DatabaseAccountCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.consistency_policy = consistency_policy + self.locations = locations + self.ip_range_filter = ip_range_filter + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.capabilities = capabilities + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access + + +class DatabaseAccountGetResults(ARMResourceProperties): + """An Azure Cosmos DB database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountKind + :param provisioning_state: + :type provisioning_state: str + :ivar document_endpoint: The connection endpoint for the Cosmos DB + database account. + :vartype document_endpoint: str + :ivar database_account_offer_type: The offer type for the Cosmos DB + database account. Default value: Standard. Possible values include: + 'Standard' + :vartype database_account_offer_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountOfferType + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param consistency_policy: The consistency policy for the Cosmos DB + database account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConsistencyPolicy + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Capability] + :ivar write_locations: An array that contains the write location for the + Cosmos DB account. + :vartype write_locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :ivar read_locations: An array that contains of the read locations enabled + for the Cosmos DB account. + :vartype read_locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :ivar locations: An array that contains all of the locations enabled for + the Cosmos DB account. + :vartype locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :ivar failover_policies: An array that contains the regions ordered by + their failover priorities. + :vartype failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.FailoverPolicy] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'database_account_offer_type': {'readonly': True}, + 'write_locations': {'readonly': True}, + 'read_locations': {'readonly': True}, + 'locations': {'readonly': True}, + 'failover_policies': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'DatabaseAccountOfferType'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'}, + 'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + def __init__(self, *, location: str=None, tags=None, kind="GlobalDocumentDB", provisioning_state: str=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, consistency_policy=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, enable_cassandra_connector: bool=None, connector_offer=None, disable_key_based_metadata_write_access: bool=None, **kwargs) -> None: + super(DatabaseAccountGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.provisioning_state = provisioning_state + self.document_endpoint = None + self.database_account_offer_type = None + self.ip_range_filter = ip_range_filter + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.consistency_policy = consistency_policy + self.capabilities = capabilities + self.write_locations = None + self.read_locations = None + self.locations = None + self.failover_policies = None + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access + + +class DatabaseAccountListConnectionStringsResult(Model): + """The connection strings for the given database account. + + :param connection_strings: An array that contains the connection strings + for the Cosmos DB account. + :type connection_strings: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountConnectionString] + """ + + _attribute_map = { + 'connection_strings': {'key': 'connectionStrings', 'type': '[DatabaseAccountConnectionString]'}, + } + + def __init__(self, *, connection_strings=None, **kwargs) -> None: + super(DatabaseAccountListConnectionStringsResult, self).__init__(**kwargs) + self.connection_strings = connection_strings + + +class DatabaseAccountListReadOnlyKeysResult(Model): + """The read-only access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DatabaseAccountListReadOnlyKeysResult, self).__init__(**kwargs) + self.primary_readonly_master_key = None + self.secondary_readonly_master_key = None + + +class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): + """The access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + :ivar primary_master_key: Base 64 encoded value of the primary read-write + key. + :vartype primary_master_key: str + :ivar secondary_master_key: Base 64 encoded value of the secondary + read-write key. + :vartype secondary_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + 'primary_master_key': {'readonly': True}, + 'secondary_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + 'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'}, + 'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DatabaseAccountListKeysResult, self).__init__(**kwargs) + self.primary_master_key = None + self.secondary_master_key = None + + +class DatabaseAccountRegenerateKeyParameters(Model): + """Parameters to regenerate the keys within the database account. + + All required parameters must be populated in order to send to Azure. + + :param key_kind: Required. The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + :type key_kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.KeyKind + """ + + _validation = { + 'key_kind': {'required': True}, + } + + _attribute_map = { + 'key_kind': {'key': 'keyKind', 'type': 'str'}, + } + + def __init__(self, *, key_kind, **kwargs) -> None: + super(DatabaseAccountRegenerateKeyParameters, self).__init__(**kwargs) + self.key_kind = key_kind + + +class DatabaseAccountUpdateParameters(Model): + """Parameters for patching Azure Cosmos DB database account properties. + + :param tags: + :type tags: dict[str, str] + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConsistencyPolicy + :param locations: An array that contains the georeplication locations + enabled for the Cosmos DB account. + :type locations: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Location] + :param ip_range_filter: Cosmos DB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param is_virtual_network_filter_enabled: Flag to indicate whether to + enable/disable Virtual Network ACL rules. + :type is_virtual_network_filter_enabled: bool + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param capabilities: List of Cosmos DB capabilities for the account + :type capabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Capability] + :param virtual_network_rules: List of Virtual Network ACL rules configured + for the Cosmos DB account. + :type virtual_network_rules: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.VirtualNetworkRule] + :param enable_multiple_write_locations: Enables the account to write in + multiple locations + :type enable_multiple_write_locations: bool + :param enable_cassandra_connector: Enables the cassandra connector on the + Cosmos DB C* account + :type enable_cassandra_connector: bool + :param connector_offer: The cassandra connector offer type for the Cosmos + DB database C* account. Possible values include: 'Small' + :type connector_offer: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConnectorOffer + :param disable_key_based_metadata_write_access: Disable write operations + on metadata resources (databases, containers, throughput) via account keys + :type disable_key_based_metadata_write_access: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + } + + def __init__(self, *, tags=None, location: str=None, consistency_policy=None, locations=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, enable_cassandra_connector: bool=None, connector_offer=None, disable_key_based_metadata_write_access: bool=None, **kwargs) -> None: + super(DatabaseAccountUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.location = location + self.consistency_policy = consistency_policy + self.locations = locations + self.ip_range_filter = ip_range_filter + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.capabilities = capabilities + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access + + +class ErrorResponse(Model): + """Error Response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ExcludedPath(Model): + """ExcludedPath. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__(self, *, path: str=None, **kwargs) -> None: + super(ExcludedPath, self).__init__(**kwargs) + self.path = path + + +class ExtendedResourceProperties(Model): + """The system generated resource properties associated with SQL databases, SQL + containers, Gremlin databases and Gremlin graphs. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + '_rid': {'key': '_rid', 'type': 'str'}, + '_ts': {'key': '_ts', 'type': 'object'}, + '_etag': {'key': '_etag', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ExtendedResourceProperties, self).__init__(**kwargs) + self._rid = None + self._ts = None + self._etag = None + + +class FailoverPolicies(Model): + """The list of new failover policies for the failover priority change. + + All required parameters must be populated in order to send to Azure. + + :param failover_policies: Required. List of failover policies. + :type failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.FailoverPolicy] + """ + + _validation = { + 'failover_policies': {'required': True}, + } + + _attribute_map = { + 'failover_policies': {'key': 'failoverPolicies', 'type': '[FailoverPolicy]'}, + } + + def __init__(self, *, failover_policies, **kwargs) -> None: + super(FailoverPolicies, self).__init__(**kwargs) + self.failover_policies = failover_policies + + +class FailoverPolicy(Model): + """The failover policy for a given region of a database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region in which the database + account replicates to. Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region in which the database account + exists. + :type location_name: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + """ + + _validation = { + 'id': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + } + + def __init__(self, *, location_name: str=None, failover_priority: int=None, **kwargs) -> None: + super(FailoverPolicy, self).__init__(**kwargs) + self.id = None + self.location_name = location_name + self.failover_priority = failover_priority + + +class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(GremlinDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class GremlinDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_database_get_results_id: Required. Name of the Cosmos DB + Gremlin database + :type gremlin_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, gremlin_database_get_results_id: str, location: str=None, tags=None, **kwargs) -> None: + super(GremlinDatabaseGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.gremlin_database_get_results_id = gremlin_database_get_results_id + self._rid = None + self._ts = None + self._etag = None + + +class GremlinDatabaseResource(Model): + """Cosmos DB Gremlin database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(GremlinDatabaseResource, self).__init__(**kwargs) + self.id = id + + +class GremlinGraphCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Gremlin graph + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinGraphResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(GremlinGraphCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class GremlinGraphGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin graph. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param gremlin_graph_get_results_id: Required. Name of the Cosmos DB + Gremlin graph + :type gremlin_graph_get_results_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionPolicy + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_graph_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'gremlin_graph_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, gremlin_graph_get_results_id: str, location: str=None, tags=None, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(GremlinGraphGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.gremlin_graph_get_results_id = gremlin_graph_get_results_id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + self._rid = None + self._ts = None + self._etag = None + + +class GremlinGraphResource(Model): + """Cosmos DB Gremlin graph resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin graph + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the graph + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + graph. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, *, id: str, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(GremlinGraphResource, self).__init__(**kwargs) + self.id = id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + + +class IncludedPath(Model): + """The paths that are included in indexing. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + :param indexes: List of indexes for this path + :type indexes: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Indexes] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, + } + + def __init__(self, *, path: str=None, indexes=None, **kwargs) -> None: + super(IncludedPath, self).__init__(**kwargs) + self.path = path + self.indexes = indexes + + +class Indexes(Model): + """The indexes for the path. + + :param data_type: The datatype for which the indexing behavior is applied + to. Possible values include: 'String', 'Number', 'Point', 'Polygon', + 'LineString', 'MultiPolygon'. Default value: "String" . + :type data_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DataType + :param precision: The precision of the index. -1 is maximum precision. + :type precision: int + :param kind: Indicates the type of index. Possible values include: 'Hash', + 'Range', 'Spatial'. Default value: "Hash" . + :type kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexKind + """ + + _attribute_map = { + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'precision': {'key': 'precision', 'type': 'int'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, data_type="String", precision: int=None, kind="Hash", **kwargs) -> None: + super(Indexes, self).__init__(**kwargs) + self.data_type = data_type + self.precision = precision + self.kind = kind + + +class IndexingPolicy(Model): + """Cosmos DB indexing policy. + + :param automatic: Indicates if the indexing policy is automatic + :type automatic: bool + :param indexing_mode: Indicates the indexing mode. Possible values + include: 'Consistent', 'Lazy', 'None'. Default value: "Consistent" . + :type indexing_mode: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingMode + :param included_paths: List of paths to include in the indexing + :type included_paths: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IncludedPath] + :param excluded_paths: List of paths to exclude from indexing + :type excluded_paths: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ExcludedPath] + """ + + _attribute_map = { + 'automatic': {'key': 'automatic', 'type': 'bool'}, + 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, + 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, + } + + def __init__(self, *, automatic: bool=None, indexing_mode="Consistent", included_paths=None, excluded_paths=None, **kwargs) -> None: + super(IndexingPolicy, self).__init__(**kwargs) + self.automatic = automatic + self.indexing_mode = indexing_mode + self.included_paths = included_paths + self.excluded_paths = excluded_paths + + +class Location(Model): + """A region in which the Azure Cosmos DB database account is deployed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region within the database account. + Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region. + :type location_name: str + :ivar document_endpoint: The connection endpoint for the specific region. + Example: + https://<accountName>-<locationName>.documents.azure.com:443/ + :vartype document_endpoint: str + :param provisioning_state: + :type provisioning_state: str + :param failover_priority: The failover priority of the region. 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. + :type failover_priority: int + :param is_zone_redundant: Flag to indicate whether or not this region is + an AvailabilityZone region + :type is_zone_redundant: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'document_endpoint': {'key': 'documentEndpoint', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + 'is_zone_redundant': {'key': 'isZoneRedundant', 'type': 'bool'}, + } + + def __init__(self, *, location_name: str=None, provisioning_state: str=None, failover_priority: int=None, is_zone_redundant: bool=None, **kwargs) -> None: + super(Location, self).__init__(**kwargs) + self.id = None + self.location_name = location_name + self.document_endpoint = None + self.provisioning_state = provisioning_state + self.failover_priority = failover_priority + self.is_zone_redundant = is_zone_redundant + + +class Metric(Model): + """Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(Metric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = unit + self.name = None + self.metric_values = None + + +class MetricAvailability(Model): + """The availability of the metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :ivar retention: The retention for the metric values. + :vartype retention: str + """ + + _validation = { + 'time_grain': {'readonly': True}, + 'retention': {'readonly': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'retention': {'key': 'retention', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = None + self.retention = None + + +class MetricDefinition(Model): + """The definition of a metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar metric_availabilities: The list of metric availabilities for the + account. + :vartype metric_availabilities: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricAvailability] + :ivar primary_aggregation_type: The primary aggregation type of the + metric. Possible values include: 'None', 'Average', 'Total', 'Minimum', + 'Maximum', 'Last' + :vartype primary_aggregation_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrimaryAggregationType + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar resource_uri: The resource uri of the database. + :vartype resource_uri: str + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + """ + + _validation = { + 'metric_availabilities': {'readonly': True}, + 'primary_aggregation_type': {'readonly': True}, + 'resource_uri': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(MetricDefinition, self).__init__(**kwargs) + self.metric_availabilities = None + self.primary_aggregation_type = None + self.unit = unit + self.resource_uri = None + self.name = None + + +class MetricName(Model): + """A metric name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The name of the metric. + :vartype value: str + :ivar localized_value: The friendly name of the metric. + :vartype localized_value: str + """ + + _validation = { + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(MetricName, self).__init__(**kwargs) + self.value = None + self.localized_value = None + + +class MetricValue(Model): + """Represents metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + } + + def __init__(self, **kwargs) -> None: + super(MetricValue, self).__init__(**kwargs) + self._count = None + self.average = None + self.maximum = None + self.minimum = None + self.timestamp = None + self.total = None + + +class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a MongoDB + collection + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBCollectionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(MongoDBCollectionCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class MongoDBCollectionGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_collection_get_results_id: Required. Name of the Cosmos DB + MongoDB collection + :type mongo_db_collection_get_results_id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoIndex] + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_collection_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_collection_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'shard_key': {'key': 'properties.shardKey', 'type': '{str}'}, + 'indexes': {'key': 'properties.indexes', 'type': '[MongoIndex]'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, mongo_db_collection_get_results_id: str, location: str=None, tags=None, shard_key=None, indexes=None, **kwargs) -> None: + super(MongoDBCollectionGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.mongo_db_collection_get_results_id = mongo_db_collection_get_results_id + self.shard_key = shard_key + self.indexes = indexes + self._rid = None + self._ts = None + self._etag = None + + +class MongoDBCollectionResource(Model): + """Cosmos DB MongoDB collection resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB collection + :type id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoIndex] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, *, id: str, shard_key=None, indexes=None, **kwargs) -> None: + super(MongoDBCollectionResource, self).__init__(**kwargs) + self.id = id + self.shard_key = shard_key + self.indexes = indexes + + +class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a MongoDB database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(MongoDBDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class MongoDBDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param mongo_db_database_get_results_id: Required. Name of the Cosmos DB + MongoDB database + :type mongo_db_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_db_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'mongo_db_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, mongo_db_database_get_results_id: str, location: str=None, tags=None, **kwargs) -> None: + super(MongoDBDatabaseGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.mongo_db_database_get_results_id = mongo_db_database_get_results_id + self._rid = None + self._ts = None + self._etag = None + + +class MongoDBDatabaseResource(Model): + """Cosmos DB MongoDB database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB MongoDB database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(MongoDBDatabaseResource, self).__init__(**kwargs) + self.id = id + + +class MongoIndex(Model): + """Cosmos DB MongoDB collection index key. + + :param key: Cosmos DB MongoDB collection index keys + :type key: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoIndexKeys + :param options: Cosmos DB MongoDB collection index key options + :type options: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoIndexOptions + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, + 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, + } + + def __init__(self, *, key=None, options=None, **kwargs) -> None: + super(MongoIndex, self).__init__(**kwargs) + self.key = key + self.options = options + + +class MongoIndexKeys(Model): + """Cosmos DB MongoDB collection resource object. + + :param keys: List of keys for each MongoDB collection in the Azure Cosmos + DB service + :type keys: list[str] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + } + + def __init__(self, *, keys=None, **kwargs) -> None: + super(MongoIndexKeys, self).__init__(**kwargs) + self.keys = keys + + +class MongoIndexOptions(Model): + """Cosmos DB MongoDB collection index options. + + :param expire_after_seconds: Expire after seconds + :type expire_after_seconds: int + :param unique: Is unique or not + :type unique: bool + """ + + _attribute_map = { + 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, + 'unique': {'key': 'unique', 'type': 'bool'}, + } + + def __init__(self, *, expire_after_seconds: int=None, unique: bool=None, **kwargs) -> None: + super(MongoIndexOptions, self).__init__(**kwargs) + self.expire_after_seconds = expire_after_seconds + self.unique = unique + + +class Operation(Model): + """REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ResourceProvider + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'Provider', 'type': 'str'}, + 'resource': {'key': 'Resource', 'type': 'str'}, + 'operation': {'key': 'Operation', 'type': 'str'}, + 'description': {'key': 'Description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class PartitionMetric(Metric): + """The metric values for a single partition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar metric_values: The metric values for the specified time window and + timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricValue] + :ivar partition_id: The partition id (GUID identifier) of the metric + values. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the metric values. + :vartype partition_key_range_id: str + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(PartitionMetric, self).__init__(unit=unit, **kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class Usage(Model): + """The usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(Usage, self).__init__(**kwargs) + self.unit = unit + self.name = None + self.quota_period = None + self.limit = None + self.current_value = None + + +class PartitionUsage(Usage): + """The partition level usage data for a usage request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric + :vartype limit: long + :ivar current_value: Current value for this metric + :vartype current_value: long + :ivar partition_id: The partition id (GUID identifier) of the usages. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer + identifier) of the usages. + :vartype partition_key_range_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(PartitionUsage, self).__init__(unit=unit, **kwargs) + self.partition_id = None + self.partition_key_range_id = None + + +class PercentileMetric(Model): + """Percentile Metric data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: datetime + :ivar time_grain: The time grain to be used to summarize the metric + values. + :vartype time_grain: str + :param unit: The unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + 'Milliseconds' + :type unit: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricName + :ivar metric_values: The percentile metric values for the specified time + window and timestep. + :vartype metric_values: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PercentileMetricValue] + """ + + _validation = { + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'name': {'readonly': True}, + 'metric_values': {'readonly': True}, + } + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[PercentileMetricValue]'}, + } + + def __init__(self, *, unit=None, **kwargs) -> None: + super(PercentileMetric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = unit + self.name = None + self.metric_values = None + + +class PercentileMetricValue(MetricValue): + """Represents percentile metrics values. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar _count: The number of values for the metric. + :vartype _count: float + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: datetime + :ivar total: The total value of the metric. + :vartype total: float + :ivar p10: The 10th percentile value for the metric. + :vartype p10: float + :ivar p25: The 25th percentile value for the metric. + :vartype p25: float + :ivar p50: The 50th percentile value for the metric. + :vartype p50: float + :ivar p75: The 75th percentile value for the metric. + :vartype p75: float + :ivar p90: The 90th percentile value for the metric. + :vartype p90: float + :ivar p95: The 95th percentile value for the metric. + :vartype p95: float + :ivar p99: The 99th percentile value for the metric. + :vartype p99: float + """ + + _validation = { + '_count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + 'p10': {'readonly': True}, + 'p25': {'readonly': True}, + 'p50': {'readonly': True}, + 'p75': {'readonly': True}, + 'p90': {'readonly': True}, + 'p95': {'readonly': True}, + 'p99': {'readonly': True}, + } + + _attribute_map = { + '_count': {'key': '_count', 'type': 'float'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + 'p10': {'key': 'P10', 'type': 'float'}, + 'p25': {'key': 'P25', 'type': 'float'}, + 'p50': {'key': 'P50', 'type': 'float'}, + 'p75': {'key': 'P75', 'type': 'float'}, + 'p90': {'key': 'P90', 'type': 'float'}, + 'p95': {'key': 'P95', 'type': 'float'}, + 'p99': {'key': 'P99', 'type': 'float'}, + } + + def __init__(self, **kwargs) -> None: + super(PercentileMetricValue, self).__init__(**kwargs) + self.p10 = None + self.p25 = None + self.p50 = None + self.p75 = None + self.p90 = None + self.p95 = None + self.p99 = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) + + +class PrivateEndpointConnection(ProxyResource): + """A private endpoint connection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param private_endpoint: Private endpoint which the connection belongs to. + :type private_endpoint: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateEndpointProperty + :param private_link_service_connection_state: Connection State of the + Private Endpoint Connection. + :type private_link_service_connection_state: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateLinkServiceConnectionStateProperty + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, + } + + def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, **kwargs) -> None: + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateEndpointProperty(Model): + """Private endpoint which the connection belongs to. + + :param id: Resource id of the private endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(PrivateEndpointProperty, self).__init__(**kwargs) + self.id = id + + +class PrivateLinkResource(ARMProxyResource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + } + + def __init__(self, **kwargs) -> None: + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + + +class PrivateLinkServiceConnectionStateProperty(Model): + """Connection State of the Private Endpoint Connection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param status: The private link service connection status. + :type status: str + :param description: The private link service connection description. + :type description: str + :ivar actions_required: Any action that is required beyond basic workflow + (approve/ reject/ disconnect) + :vartype actions_required: str + """ + + _validation = { + 'actions_required': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__(self, *, status: str=None, description: str=None, **kwargs) -> None: + super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = None + + +class RegionForOnlineOffline(Model): + """Cosmos DB region to online or offline. + + All required parameters must be populated in order to send to Azure. + + :param region: Required. Cosmos DB region, with spaces between words and + each word capitalized. + :type region: str + """ + + _validation = { + 'region': {'required': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, *, region: str, **kwargs) -> None: + super(RegionForOnlineOffline, self).__init__(**kwargs) + self.region = region + + +class SqlContainerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a container + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlContainerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlContainerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlContainerCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlContainerGetResults(ARMResourceProperties): + """An Azure Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_container_get_results_id: Required. Name of the Cosmos DB SQL + container + :type sql_container_get_results_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionPolicy + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_container_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_container_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, sql_container_get_results_id: str, location: str=None, tags=None, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(SqlContainerGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_container_get_results_id = sql_container_get_results_id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + self._rid = None + self._ts = None + self._etag = None + + +class SqlContainerResource(Model): + """Cosmos DB SQL container resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL container + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, *, id: str, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(SqlContainerResource, self).__init__(**kwargs) + self.id = id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + + +class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a SQL database + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_database_get_results_id: Required. Name of the Cosmos DB SQL + database + :type sql_database_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + :param _colls: A system generated property that specified the addressable + path of the collections resource. + :type _colls: str + :param _users: A system generated property that specifies the addressable + path of the users resource. + :type _users: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_database_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + '_colls': {'key': 'properties._colls', 'type': 'str'}, + '_users': {'key': 'properties._users', 'type': 'str'}, + } + + def __init__(self, *, sql_database_get_results_id: str, location: str=None, tags=None, _colls: str=None, _users: str=None, **kwargs) -> None: + super(SqlDatabaseGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_database_get_results_id = sql_database_get_results_id + self._rid = None + self._ts = None + self._etag = None + self._colls = _colls + self._users = _users + + +class SqlDatabaseResource(Model): + """Cosmos DB SQL database resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(SqlDatabaseResource, self).__init__(**kwargs) + self.id = id + + +class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB storedProcedure. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a storedProcedure + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlStoredProcedureResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlStoredProcedureResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlStoredProcedureCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlStoredProcedureGetResults(ARMResourceProperties): + """An Azure Cosmos DB storedProcedure. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_stored_procedure_get_results_id: Required. Name of the Cosmos + DB SQL storedProcedure + :type sql_stored_procedure_get_results_id: str + :param body: Body of the Stored Procedure + :type body: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_stored_procedure_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_stored_procedure_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, sql_stored_procedure_get_results_id: str, location: str=None, tags=None, body: str=None, **kwargs) -> None: + super(SqlStoredProcedureGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_stored_procedure_get_results_id = sql_stored_procedure_get_results_id + self.body = body + self._rid = None + self._ts = None + self._etag = None + + +class SqlStoredProcedureResource(Model): + """Cosmos DB SQL storedProcedure resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL storedProcedure + :type id: str + :param body: Body of the Stored Procedure + :type body: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + } + + def __init__(self, *, id: str, body: str=None, **kwargs) -> None: + super(SqlStoredProcedureResource, self).__init__(**kwargs) + self.id = id + self.body = body + + +class SqlTriggerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB trigger. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a trigger + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlTriggerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlTriggerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlTriggerCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlTriggerGetResults(ARMResourceProperties): + """An Azure Cosmos DB trigger. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_trigger_get_results_id: Required. Name of the Cosmos DB SQL + trigger + :type sql_trigger_get_results_id: str + :param body: Body of the Trigger + :type body: str + :param trigger_type: Type of the Trigger. Possible values include: 'Pre', + 'Post' + :type trigger_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TriggerType + :param trigger_operation: The operation the trigger is associated with. + Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' + :type trigger_operation: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TriggerOperation + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_trigger_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_trigger_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + 'trigger_type': {'key': 'properties.triggerType', 'type': 'str'}, + 'trigger_operation': {'key': 'properties.triggerOperation', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, sql_trigger_get_results_id: str, location: str=None, tags=None, body: str=None, trigger_type=None, trigger_operation=None, **kwargs) -> None: + super(SqlTriggerGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_trigger_get_results_id = sql_trigger_get_results_id + self.body = body + self.trigger_type = trigger_type + self.trigger_operation = trigger_operation + self._rid = None + self._ts = None + self._etag = None + + +class SqlTriggerResource(Model): + """Cosmos DB SQL trigger resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL trigger + :type id: str + :param body: Body of the Trigger + :type body: str + :param trigger_type: Type of the Trigger. Possible values include: 'Pre', + 'Post' + :type trigger_type: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TriggerType + :param trigger_operation: The operation the trigger is associated with. + Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' + :type trigger_operation: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TriggerOperation + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + 'trigger_type': {'key': 'triggerType', 'type': 'str'}, + 'trigger_operation': {'key': 'triggerOperation', 'type': 'str'}, + } + + def __init__(self, *, id: str, body: str=None, trigger_type=None, trigger_operation=None, **kwargs) -> None: + super(SqlTriggerResource, self).__init__(**kwargs) + self.id = id + self.body = body + self.trigger_type = trigger_type + self.trigger_operation = trigger_operation + + +class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB userDefinedFunction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a + userDefinedFunction + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlUserDefinedFunctionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlUserDefinedFunctionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(SqlUserDefinedFunctionCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class SqlUserDefinedFunctionGetResults(ARMResourceProperties): + """An Azure Cosmos DB userDefinedFunction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param sql_user_defined_function_get_results_id: Required. Name of the + Cosmos DB SQL userDefinedFunction + :type sql_user_defined_function_get_results_id: str + :param body: Body of the User Defined Function + :type body: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_user_defined_function_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sql_user_defined_function_get_results_id': {'key': 'properties.id', 'type': 'str'}, + 'body': {'key': 'properties.body', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, sql_user_defined_function_get_results_id: str, location: str=None, tags=None, body: str=None, **kwargs) -> None: + super(SqlUserDefinedFunctionGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.sql_user_defined_function_get_results_id = sql_user_defined_function_get_results_id + self.body = body + self._rid = None + self._ts = None + self._etag = None + + +class SqlUserDefinedFunctionResource(Model): + """Cosmos DB SQL userDefinedFunction resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL userDefinedFunction + :type id: str + :param body: Body of the User Defined Function + :type body: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + } + + def __init__(self, *, id: str, body: str=None, **kwargs) -> None: + super(SqlUserDefinedFunctionResource, self).__init__(**kwargs) + self.id = id + self.body = body + + +class TableCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a Table + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'TableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, location: str=None, tags=None, **kwargs) -> None: + super(TableCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class TableGetResults(ARMResourceProperties): + """An Azure Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param table_get_results_id: Required. Name of the Cosmos DB table + :type table_get_results_id: str + :ivar _rid: A system generated property. A unique identifier. + :vartype _rid: str + :ivar _ts: A system generated property that denotes the last updated + timestamp of the resource. + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :vartype _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'table_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'table_get_results_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, table_get_results_id: str, location: str=None, tags=None, **kwargs) -> None: + super(TableGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.table_get_results_id = table_get_results_id + self._rid = None + self._ts = None + self._etag = None + + +class TableResource(Model): + """Cosmos DB table resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB table + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(TableResource, self).__init__(**kwargs) + self.id = id + + +class ThroughputSettingsGetResults(ARMResourceProperties): + """An Azure Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + :ivar minimum_throughput: The minimum throughput of the resource + :vartype minimum_throughput: str + :ivar offer_replace_pending: The throughput replace is pending + :vartype offer_replace_pending: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'throughput': {'key': 'properties.throughput', 'type': 'int'}, + 'minimum_throughput': {'key': 'properties.minimumThroughput', 'type': 'str'}, + 'offer_replace_pending': {'key': 'properties.offerReplacePending', 'type': 'str'}, + } + + def __init__(self, *, throughput: int, location: str=None, tags=None, **kwargs) -> None: + super(ThroughputSettingsGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.throughput = throughput + self.minimum_throughput = None + self.offer_replace_pending = None + + +class ThroughputSettingsResource(Model): + """Cosmos DB resource throughput object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param throughput: Required. Value of the Cosmos DB resource throughput + :type throughput: int + :ivar minimum_throughput: The minimum throughput of the resource + :vartype minimum_throughput: str + :ivar offer_replace_pending: The throughput replace is pending + :vartype offer_replace_pending: str + """ + + _validation = { + 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, + } + + _attribute_map = { + 'throughput': {'key': 'throughput', 'type': 'int'}, + 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, + 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, + } + + def __init__(self, *, throughput: int, **kwargs) -> None: + super(ThroughputSettingsResource, self).__init__(**kwargs) + self.throughput = throughput + self.minimum_throughput = None + self.offer_replace_pending = None + + +class ThroughputSettingsUpdateParameters(ARMResourceProperties): + """Parameters to update Cosmos DB resource throughput. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict[str, str] + :param resource: Required. The standard JSON format of a resource + throughput + :type resource: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsResource + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'ThroughputSettingsResource'}, + } + + def __init__(self, *, resource, location: str=None, tags=None, **kwargs) -> None: + super(ThroughputSettingsUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class UniqueKey(Model): + """The unique key on that enforces uniqueness constraint on documents in the + collection in the Azure Cosmos DB service. + + :param paths: List of paths must be unique for each document in the Azure + Cosmos DB service + :type paths: list[str] + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + } + + def __init__(self, *, paths=None, **kwargs) -> None: + super(UniqueKey, self).__init__(**kwargs) + self.paths = paths + + +class UniqueKeyPolicy(Model): + """The unique key policy configuration for specifying uniqueness constraints + on documents in the collection in the Azure Cosmos DB service. + + :param unique_keys: List of unique keys on that enforces uniqueness + constraint on documents in the collection in the Azure Cosmos DB service. + :type unique_keys: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UniqueKey] + """ + + _attribute_map = { + 'unique_keys': {'key': 'uniqueKeys', 'type': '[UniqueKey]'}, + } + + def __init__(self, *, unique_keys=None, **kwargs) -> None: + super(UniqueKeyPolicy, self).__init__(**kwargs) + self.unique_keys = unique_keys + + +class VirtualNetworkRule(Model): + """Virtual Network ACL Rule object. + + :param id: Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :type id: str + :param ignore_missing_vnet_service_endpoint: Create firewall rule before + the virtual network has vnet service endpoint enabled. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVNetServiceEndpoint', 'type': 'bool'}, + } + + def __init__(self, *, id: str=None, ignore_missing_vnet_service_endpoint: bool=None, **kwargs) -> None: + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = id + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_paged_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..bff93ad9f4ac --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/models/_paged_models.py @@ -0,0 +1,300 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class DatabaseAccountGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`DatabaseAccountGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DatabaseAccountGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(DatabaseAccountGetResultsPaged, self).__init__(*args, **kwargs) +class MetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`Metric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Metric]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricPaged, self).__init__(*args, **kwargs) +class UsagePaged(Paged): + """ + A paging container for iterating over a list of :class:`Usage ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Usage]'} + } + + def __init__(self, *args, **kwargs): + + super(UsagePaged, self).__init__(*args, **kwargs) +class MetricDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricDefinitionPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class PercentileMetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`PercentileMetric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PercentileMetric]'} + } + + def __init__(self, *args, **kwargs): + + super(PercentileMetricPaged, self).__init__(*args, **kwargs) +class PartitionMetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`PartitionMetric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PartitionMetric]'} + } + + def __init__(self, *args, **kwargs): + + super(PartitionMetricPaged, self).__init__(*args, **kwargs) +class PartitionUsagePaged(Paged): + """ + A paging container for iterating over a list of :class:`PartitionUsage ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PartitionUsage]'} + } + + def __init__(self, *args, **kwargs): + + super(PartitionUsagePaged, self).__init__(*args, **kwargs) +class SqlDatabaseGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlDatabaseGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlDatabaseGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlDatabaseGetResultsPaged, self).__init__(*args, **kwargs) +class SqlContainerGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlContainerGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlContainerGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlContainerGetResultsPaged, self).__init__(*args, **kwargs) +class SqlStoredProcedureGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlStoredProcedureGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlStoredProcedureGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlStoredProcedureGetResultsPaged, self).__init__(*args, **kwargs) +class SqlUserDefinedFunctionGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlUserDefinedFunctionGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlUserDefinedFunctionGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlUserDefinedFunctionGetResultsPaged, self).__init__(*args, **kwargs) +class SqlTriggerGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlTriggerGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlTriggerGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlTriggerGetResultsPaged, self).__init__(*args, **kwargs) +class MongoDBDatabaseGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`MongoDBDatabaseGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MongoDBDatabaseGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(MongoDBDatabaseGetResultsPaged, self).__init__(*args, **kwargs) +class MongoDBCollectionGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`MongoDBCollectionGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MongoDBCollectionGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(MongoDBCollectionGetResultsPaged, self).__init__(*args, **kwargs) +class TableGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`TableGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[TableGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(TableGetResultsPaged, self).__init__(*args, **kwargs) +class CassandraKeyspaceGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`CassandraKeyspaceGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CassandraKeyspaceGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(CassandraKeyspaceGetResultsPaged, self).__init__(*args, **kwargs) +class CassandraTableGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`CassandraTableGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CassandraTableGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(CassandraTableGetResultsPaged, self).__init__(*args, **kwargs) +class GremlinDatabaseGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`GremlinDatabaseGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GremlinDatabaseGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(GremlinDatabaseGetResultsPaged, self).__init__(*args, **kwargs) +class GremlinGraphGetResultsPaged(Paged): + """ + A paging container for iterating over a list of :class:`GremlinGraphGetResults ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GremlinGraphGetResults]'} + } + + def __init__(self, *args, **kwargs): + + super(GremlinGraphGetResultsPaged, self).__init__(*args, **kwargs) +class PrivateLinkResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`PrivateLinkResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PrivateLinkResource]'} + } + + def __init__(self, *args, **kwargs): + + super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) +class PrivateEndpointConnectionPaged(Paged): + """ + A paging container for iterating over a list of :class:`PrivateEndpointConnection ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PrivateEndpointConnection]'} + } + + def __init__(self, *args, **kwargs): + + super(PrivateEndpointConnectionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/__init__.py new file mode 100644 index 000000000000..e95f28e83a62 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/__init__.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._database_accounts_operations import DatabaseAccountsOperations +from ._operations import Operations +from ._database_operations import DatabaseOperations +from ._collection_operations import CollectionOperations +from ._collection_region_operations import CollectionRegionOperations +from ._database_account_region_operations import DatabaseAccountRegionOperations +from ._percentile_source_target_operations import PercentileSourceTargetOperations +from ._percentile_target_operations import PercentileTargetOperations +from ._percentile_operations import PercentileOperations +from ._collection_partition_region_operations import CollectionPartitionRegionOperations +from ._collection_partition_operations import CollectionPartitionOperations +from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations +from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations +from ._sql_resources_operations import SqlResourcesOperations +from ._mongo_db_resources_operations import MongoDBResourcesOperations +from ._table_resources_operations import TableResourcesOperations +from ._cassandra_resources_operations import CassandraResourcesOperations +from ._gremlin_resources_operations import GremlinResourcesOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations + +__all__ = [ + 'DatabaseAccountsOperations', + 'Operations', + 'DatabaseOperations', + 'CollectionOperations', + 'CollectionRegionOperations', + 'DatabaseAccountRegionOperations', + 'PercentileSourceTargetOperations', + 'PercentileTargetOperations', + 'PercentileOperations', + 'CollectionPartitionRegionOperations', + 'CollectionPartitionOperations', + 'PartitionKeyRangeIdOperations', + 'PartitionKeyRangeIdRegionOperations', + 'SqlResourcesOperations', + 'MongoDBResourcesOperations', + 'TableResourcesOperations', + 'CassandraResourcesOperations', + 'GremlinResourcesOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', +] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_cassandra_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_cassandra_resources_operations.py new file mode 100644 index 000000000000..12ae23f20b46 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_cassandra_resources_operations.py @@ -0,0 +1,1067 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class CassandraResourcesOperations(object): + """CassandraResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_cassandra_keyspaces( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Cassandra keyspaces under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of CassandraKeyspaceGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraKeyspaceGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraKeyspaceGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_cassandra_keyspaces.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.CassandraKeyspaceGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_cassandra_keyspaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces'} + + def get_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CassandraKeyspaceGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraKeyspaceGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_keyspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CassandraKeyspaceGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}'} + + + def _create_update_cassandra_keyspace_initial( + self, resource_group_name, account_name, keyspace_name, create_update_cassandra_keyspace_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_cassandra_keyspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_cassandra_keyspace_parameters, 'CassandraKeyspaceCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CassandraKeyspaceGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_name, create_update_cassandra_keyspace_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Cassandra keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to + provide for the current Cassandra keyspace. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraKeyspaceCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + CassandraKeyspaceGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraKeyspaceGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraKeyspaceGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_cassandra_keyspace_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + create_update_cassandra_keyspace_parameters=create_update_cassandra_keyspace_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CassandraKeyspaceGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}'} + + + def _delete_cassandra_keyspace_initial( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_cassandra_keyspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Cassandra keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_cassandra_keyspace_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}'} + + def get_cassandra_keyspace_throughput( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Cassandra Keyspace under an existing + Azure Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_keyspace_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_keyspace_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default'} + + + def _update_cassandra_keyspace_throughput_initial( + self, resource_group_name, account_name, keyspace_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_cassandra_keyspace_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_cassandra_keyspace_throughput( + self, resource_group_name, account_name, keyspace_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current Cassandra Keyspace. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_cassandra_keyspace_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_cassandra_keyspace_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default'} + + def list_cassandra_tables( + self, resource_group_name, account_name, keyspace_name, custom_headers=None, raw=False, **operation_config): + """Lists the Cassandra table under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of CassandraTableGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraTableGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraTableGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_cassandra_tables.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.CassandraTableGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_cassandra_tables.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables'} + + def get_cassandra_table( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the Cassandra table under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CassandraTableGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraTableGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CassandraTableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}'} + + + def _create_update_cassandra_table_initial( + self, resource_group_name, account_name, keyspace_name, table_name, create_update_cassandra_table_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_cassandra_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_cassandra_table_parameters, 'CassandraTableCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CassandraTableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_cassandra_table( + self, resource_group_name, account_name, keyspace_name, table_name, create_update_cassandra_table_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Cassandra Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to + provide for the current Cassandra Table. + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraTableCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + CassandraTableGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraTableGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.CassandraTableGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_cassandra_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + table_name=table_name, + create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CassandraTableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}'} + + + def _delete_cassandra_table_initial( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_cassandra_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_cassandra_table( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Cassandra table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_cassandra_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + table_name=table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}'} + + def get_cassandra_table_throughput( + self, resource_group_name, account_name, keyspace_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Cassandra table under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default'} + + + def _update_cassandra_table_throughput_initial( + self, resource_group_name, account_name, keyspace_name, table_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_cassandra_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_cassandra_table_throughput( + self, resource_group_name, account_name, keyspace_name, table_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Cassandra table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. + :type keyspace_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current Cassandra table. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_cassandra_table_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + table_name=table_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_cassandra_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_operations.py new file mode 100644 index 000000000000..f0d5c4926b70 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_operations.py @@ -0,0 +1,288 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionOperations(object): + """CollectionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account and collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics'} + + def list_usages( + self, resource_group_name, account_name, database_rid, collection_rid, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent storage data) for the given + collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UsagePaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Usage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages'} + + def list_metric_definitions( + self, resource_group_name, account_name, database_rid, collection_rid, custom_headers=None, raw=False, **operation_config): + """Retrieves metric definitions for the given collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricDefinitionPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_partition_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_partition_operations.py new file mode 100644 index 000000000000..15c5ab91a3d4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_partition_operations.py @@ -0,0 +1,210 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionPartitionOperations(object): + """CollectionPartitionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + collection, split by partition. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics'} + + def list_usages( + self, resource_group_name, account_name, database_rid, collection_rid, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent storage data) for the given + collection, split by partition. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionUsage + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionUsagePaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionUsage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionUsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_partition_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_partition_region_operations.py new file mode 100644 index 000000000000..9acc83579316 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_partition_region_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionPartitionRegionOperations(object): + """CollectionPartitionRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + collection and region, split by partition. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_region_operations.py new file mode 100644 index 000000000000..ec980f44dbc6 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_collection_region_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class CollectionRegionOperations(object): + """CollectionRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account, collection and region. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_database_account_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_database_account_region_operations.py new file mode 100644 index 000000000000..a7512fa30bb3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_database_account_region_operations.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class DatabaseAccountRegionOperations(object): + """DatabaseAccountRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account and region. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_database_accounts_operations.py new file mode 100644 index 000000000000..ff7333e7b858 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_database_accounts_operations.py @@ -0,0 +1,1429 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class DatabaseAccountsOperations(object): + """DatabaseAccountsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def get( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Retrieves the properties of an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _update_initial( + self, resource_group_name, account_name, update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_parameters, 'DatabaseAccountUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, account_name, update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates the properties of an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param update_parameters: The parameters to provide for the current + database account. + :type update_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + DatabaseAccountGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + update_parameters=update_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _create_or_update_initial( + self, resource_group_name, account_name, create_update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_parameters, 'DatabaseAccountCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, account_name, create_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates an Azure Cosmos DB database account. The "Update" + method is preferred when performing updates on an account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param create_update_parameters: The parameters to provide for the + current database account. + :type create_update_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + DatabaseAccountGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + create_update_parameters=create_update_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DatabaseAccountGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _delete_initial( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, account_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'} + + + def _failover_priority_change_initial( + self, resource_group_name, account_name, failover_policies, custom_headers=None, raw=False, **operation_config): + failover_parameters = models.FailoverPolicies(failover_policies=failover_policies) + + # Construct URL + url = self.failover_priority_change.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(failover_parameters, 'FailoverPolicies') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def failover_priority_change( + self, resource_group_name, account_name, failover_policies, custom_headers=None, raw=False, polling=True, **operation_config): + """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. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param failover_policies: List of failover policies. + :type failover_policies: + list[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.FailoverPolicy] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._failover_priority_change_initial( + resource_group_name=resource_group_name, + account_name=account_name, + failover_policies=failover_policies, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + failover_priority_change.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the Azure Cosmos DB database accounts available under the + subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DatabaseAccountGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DatabaseAccountGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists all the Azure Cosmos DB database accounts available under the + given resource group. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DatabaseAccountGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DatabaseAccountGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts'} + + def list_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the access keys for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListKeysResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountListKeysResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys'} + + def list_connection_strings( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the connection strings for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListConnectionStringsResult or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountListConnectionStringsResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_connection_strings.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListConnectionStringsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings'} + + + def _offline_region_initial( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, **operation_config): + region_parameter_for_offline = models.RegionForOnlineOffline(region=region) + + # Construct URL + url = self.offline_region.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(region_parameter_for_offline, 'RegionForOnlineOffline') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def offline_region( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, polling=True, **operation_config): + """Offline the specified region for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._offline_region_initial( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + offline_region.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion'} + + + def _online_region_initial( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, **operation_config): + region_parameter_for_online = models.RegionForOnlineOffline(region=region) + + # Construct URL + url = self.online_region.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(region_parameter_for_online, 'RegionForOnlineOffline') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def online_region( + self, resource_group_name, account_name, region, custom_headers=None, raw=False, polling=True, **operation_config): + """Online the specified region for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._online_region_initial( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + online_region.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion'} + + def get_read_only_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the read-only access keys for the specified Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListReadOnlyKeysResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountListReadOnlyKeysResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_read_only_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListReadOnlyKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_read_only_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys'} + + def list_read_only_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the read-only access keys for the specified Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DatabaseAccountListReadOnlyKeysResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.DatabaseAccountListReadOnlyKeysResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_read_only_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListReadOnlyKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_read_only_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys'} + + + def _regenerate_key_initial( + self, resource_group_name, account_name, key_kind, custom_headers=None, raw=False, **operation_config): + key_to_regenerate = models.DatabaseAccountRegenerateKeyParameters(key_kind=key_kind) + + # Construct URL + url = self.regenerate_key.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(key_to_regenerate, 'DatabaseAccountRegenerateKeyParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def regenerate_key( + self, resource_group_name, account_name, key_kind, custom_headers=None, raw=False, polling=True, **operation_config): + """Regenerates an access key for the specified Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param key_kind: The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', + 'secondaryReadonly' + :type key_kind: str or + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.KeyKind + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._regenerate_key_initial( + resource_group_name=resource_group_name, + account_name=account_name, + key_kind=key_kind, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey'} + + def check_name_exists( + self, account_name, custom_headers=None, raw=False, **operation_config): + """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. + + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: bool or ClientRawResponse if raw=true + :rtype: bool or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_name_exists.metadata['url'] + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = (response.status_code == 200) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + return deserialized + check_name_exists.metadata = {'url': '/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}'} + + def list_metrics( + self, resource_group_name, account_name, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics'} + + def list_usages( + self, resource_group_name, account_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent data) for the given database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UsagePaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Usage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages'} + + def list_metric_definitions( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Retrieves metric definitions for the given database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricDefinitionPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_database_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_database_operations.py new file mode 100644 index 000000000000..869726c4ee6e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_database_operations.py @@ -0,0 +1,278 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class DatabaseOperations(object): + """DatabaseOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account and database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Metric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics'} + + def list_usages( + self, resource_group_name, account_name, database_rid, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves the usages (most recent data) for the given database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param filter: 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). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.UsagePaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Usage] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages'} + + def list_metric_definitions( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + """Retrieves metric definitions for the given database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricDefinitionPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MetricDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_gremlin_resources_operations.py new file mode 100644 index 000000000000..2d561dee794e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_gremlin_resources_operations.py @@ -0,0 +1,1066 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class GremlinResourcesOperations(object): + """GremlinResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_gremlin_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Gremlin databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GremlinDatabaseGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinDatabaseGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinDatabaseGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_gremlin_databases.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GremlinDatabaseGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_gremlin_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases'} + + def get_gremlin_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin databases under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GremlinDatabaseGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinDatabaseGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GremlinDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}'} + + + def _create_update_gremlin_database_initial( + self, resource_group_name, account_name, database_name, create_update_gremlin_database_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_gremlin_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_gremlin_database_parameters, 'GremlinDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GremlinDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_gremlin_database( + self, resource_group_name, account_name, database_name, create_update_gremlin_database_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param create_update_gremlin_database_parameters: The parameters to + provide for the current Gremlin database. + :type create_update_gremlin_database_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinDatabaseCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + GremlinDatabaseGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinDatabaseGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinDatabaseGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + create_update_gremlin_database_parameters=create_update_gremlin_database_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GremlinDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}'} + + + def _delete_gremlin_database_initial( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_gremlin_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_gremlin_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}'} + + def get_gremlin_database_throughput( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Gremlin database under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default'} + + + def _update_gremlin_database_throughput_initial( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_gremlin_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_gremlin_database_throughput( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current Gremlin database. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_gremlin_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_gremlin_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default'} + + def list_gremlin_graphs( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the Gremlin graph under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GremlinGraphGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinGraphGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinGraphGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_gremlin_graphs.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GremlinGraphGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_gremlin_graphs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs'} + + def get_gremlin_graph( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin graph under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GremlinGraphGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinGraphGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_graph.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GremlinGraphGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_graph.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'} + + + def _create_update_gremlin_graph_initial( + self, resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_gremlin_graph.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_gremlin_graph_parameters, 'GremlinGraphCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GremlinGraphGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_gremlin_graph( + self, resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to + provide for the current Gremlin graph. + :type create_update_gremlin_graph_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinGraphCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns GremlinGraphGetResults + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinGraphGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.GremlinGraphGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_gremlin_graph_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + create_update_gremlin_graph_parameters=create_update_gremlin_graph_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GremlinGraphGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_gremlin_graph.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'} + + + def _delete_gremlin_graph_initial( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_gremlin_graph.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_gremlin_graph( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Gremlin graph. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_gremlin_graph_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_gremlin_graph.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'} + + def get_gremlin_graph_throughput( + self, resource_group_name, account_name, database_name, graph_name, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin graph throughput under an existing Azure Cosmos DB + database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_graph_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_graph_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default'} + + + def _update_gremlin_graph_throughput_initial( + self, resource_group_name, account_name, database_name, graph_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_gremlin_graph_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_gremlin_graph_throughput( + self, resource_group_name, account_name, database_name, graph_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param graph_name: Cosmos DB graph name. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current Gremlin graph. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_gremlin_graph_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_gremlin_graph_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_mongo_db_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_mongo_db_resources_operations.py new file mode 100644 index 000000000000..83d57d5033d4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_mongo_db_resources_operations.py @@ -0,0 +1,1067 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class MongoDBResourcesOperations(object): + """MongoDBResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_mongo_db_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the MongoDB databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MongoDBDatabaseGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBDatabaseGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBDatabaseGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_mongo_db_databases.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MongoDBDatabaseGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_mongo_db_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases'} + + def get_mongo_db_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the MongoDB databases under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MongoDBDatabaseGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBDatabaseGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MongoDBDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}'} + + + def _create_update_mongo_db_database_initial( + self, resource_group_name, account_name, database_name, create_update_mongo_db_database_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_mongo_db_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_mongo_db_database_parameters, 'MongoDBDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MongoDBDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_mongo_db_database( + self, resource_group_name, account_name, database_name, create_update_mongo_db_database_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or updates Azure Cosmos DB MongoDB database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param create_update_mongo_db_database_parameters: The parameters to + provide for the current MongoDB database. + :type create_update_mongo_db_database_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBDatabaseCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + MongoDBDatabaseGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBDatabaseGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBDatabaseGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_mongo_db_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + create_update_mongo_db_database_parameters=create_update_mongo_db_database_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('MongoDBDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_mongo_db_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}'} + + + def _delete_mongo_db_database_initial( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_mongo_db_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_mongo_db_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB MongoDB database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_mongo_db_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_mongo_db_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}'} + + def get_mongo_db_database_throughput( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the MongoDB database under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default'} + + + def _update_mongo_db_database_throughput_initial( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_mongo_db_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_mongo_db_database_throughput( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of the an Azure Cosmos DB MongoDB database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current MongoDB database. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_mongo_db_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_mongo_db_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default'} + + def list_mongo_db_collections( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the MongoDB collection under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MongoDBCollectionGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBCollectionGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBCollectionGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_mongo_db_collections.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MongoDBCollectionGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_mongo_db_collections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections'} + + def get_mongo_db_collection( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, **operation_config): + """Gets the MongoDB collection under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MongoDBCollectionGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBCollectionGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_collection.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MongoDBCollectionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'} + + + def _create_update_mongo_db_collection_initial( + self, resource_group_name, account_name, database_name, collection_name, create_update_mongo_db_collection_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_mongo_db_collection.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_mongo_db_collection_parameters, 'MongoDBCollectionCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MongoDBCollectionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_mongo_db_collection( + self, resource_group_name, account_name, database_name, collection_name, create_update_mongo_db_collection_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB MongoDB Collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param create_update_mongo_db_collection_parameters: The parameters to + provide for the current MongoDB Collection. + :type create_update_mongo_db_collection_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBCollectionCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + MongoDBCollectionGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBCollectionGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.MongoDBCollectionGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_mongo_db_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + create_update_mongo_db_collection_parameters=create_update_mongo_db_collection_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('MongoDBCollectionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'} + + + def _delete_mongo_db_collection_initial( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_mongo_db_collection.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_mongo_db_collection( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB MongoDB Collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_mongo_db_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'} + + def get_mongo_db_collection_throughput( + self, resource_group_name, account_name, database_name, collection_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the MongoDB collection under an existing + Azure Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_db_collection_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_db_collection_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default'} + + + def _update_mongo_db_collection_throughput_initial( + self, resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_mongo_db_collection_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_mongo_db_collection_throughput( + self, resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param update_throughput_parameters: The RUs per second of the + parameters to provide for the current MongoDB collection. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_mongo_db_collection_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_mongo_db_collection_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_operations.py new file mode 100644 index 000000000000..be2fe38927fd --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_operations.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Cosmos DB Resource Provider operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.OperationPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.Operation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.DocumentDB/operations'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_partition_key_range_id_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_partition_key_range_id_operations.py new file mode 100644 index 000000000000..3752b3152c98 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_partition_key_range_id_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PartitionKeyRangeIdOperations(object): + """PartitionKeyRangeIdOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, database_rid, collection_rid, partition_key_range_id, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + partition key range id. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get + data. + :type partition_key_range_id: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str'), + 'partitionKeyRangeId': self._serialize.url("partition_key_range_id", partition_key_range_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_partition_key_range_id_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_partition_key_range_id_region_operations.py new file mode 100644 index 000000000000..43434039be44 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_partition_key_range_id_region_operations.py @@ -0,0 +1,133 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PartitionKeyRangeIdRegionOperations(object): + """PartitionKeyRangeIdRegionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, region, database_rid, collection_rid, partition_key_range_id, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + partition key range id and region. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each + word capitalized. + :type region: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get + data. + :type partition_key_range_id: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartitionMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PartitionMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'region': self._serialize.url("region", region, 'str'), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, 'str'), + 'partitionKeyRangeId': self._serialize.url("partition_key_range_id", partition_key_range_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartitionMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_percentile_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_percentile_operations.py new file mode 100644 index 000000000000..1af17f00ec45 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_percentile_operations.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PercentileOperations(object): + """PercentileOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + database account. This url is only for PBS and Replication Latency + data. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PercentileMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PercentileMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PercentileMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PercentileMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_percentile_source_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_percentile_source_target_operations.py new file mode 100644 index 000000000000..62ffd3134b2b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_percentile_source_target_operations.py @@ -0,0 +1,128 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PercentileSourceTargetOperations(object): + """PercentileSourceTargetOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, source_region, target_region, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + account, source and target region. This url is only for PBS and + Replication Latency data. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param source_region: Source region from which data is written. Cosmos + DB region, with spaces between words and each word capitalized. + :type source_region: str + :param target_region: Target region to which data is written. Cosmos + DB region, with spaces between words and each word capitalized. + :type target_region: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PercentileMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PercentileMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PercentileMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'sourceRegion': self._serialize.url("source_region", source_region, 'str'), + 'targetRegion': self._serialize.url("target_region", target_region, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PercentileMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_percentile_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_percentile_target_operations.py new file mode 100644 index 000000000000..9a930f538d4b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_percentile_target_operations.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PercentileTargetOperations(object): + """PercentileTargetOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_metrics( + self, resource_group_name, account_name, target_region, filter, custom_headers=None, raw=False, **operation_config): + """Retrieves the metrics determined by the given filter for the given + account target region. This url is only for PBS and Replication Latency + data. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param target_region: Target region to which data is written. Cosmos + DB region, with spaces between words and each word capitalized. + :type target_region: str + :param filter: 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. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PercentileMetric + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PercentileMetricPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PercentileMetric] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'targetRegion': self._serialize.url("target_region", target_region, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PercentileMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..a2b808976486 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,381 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-08-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01-preview" + + self.config = config + + def list_by_database_account( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """List all private endpoint connections on a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateEndpointConnectionPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateEndpointConnection] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_database_account.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PrivateEndpointConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_database_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections'} + + def get( + self, resource_group_name, account_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + """Gets a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param private_endpoint_connection_name: The name of the private + endpoint connection. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateEndpointConnection or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateEndpointConnection + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + + def _create_or_update_initial( + self, resource_group_name, account_name, private_endpoint_connection_name, private_endpoint=None, private_link_service_connection_state=None, custom_headers=None, raw=False, **operation_config): + parameters = models.PrivateEndpointConnection(private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, account_name, private_endpoint_connection_name, private_endpoint=None, private_link_service_connection_state=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param private_endpoint_connection_name: The name of the private + endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint: Private endpoint which the connection belongs + to. + :type private_endpoint: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateEndpointProperty + :param private_link_service_connection_state: Connection State of the + Private Endpoint Connection. + :type private_link_service_connection_state: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateLinkServiceConnectionStateProperty + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + PrivateEndpointConnection or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateEndpointConnection] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateEndpointConnection]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint=private_endpoint, + private_link_service_connection_state=private_link_service_connection_state, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + + def _delete_initial( + self, resource_group_name, account_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, account_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param private_endpoint_connection_name: The name of the private + endpoint connection. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_private_link_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..5bafc3d23d80 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,179 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01-preview" + + self.config = config + + def list_by_database_account( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Gets the private link resources that need to be created for a Cosmos DB + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateLinkResourcePaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateLinkResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_database_account.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PrivateLinkResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_database_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources'} + + def get( + self, resource_group_name, account_name, group_name, custom_headers=None, raw=False, **operation_config): + """Gets the private link resources that need to be created for a Cosmos DB + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param group_name: The name of the private link resource. + :type group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateLinkResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.PrivateLinkResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'groupName': self._serialize.url("group_name", group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateLinkResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_sql_resources_operations.py new file mode 100644 index 000000000000..59061ff50a84 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_sql_resources_operations.py @@ -0,0 +1,2136 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class SqlResourcesOperations(object): + """SqlResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_sql_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlDatabaseGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlDatabaseGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlDatabaseGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_databases.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlDatabaseGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases'} + + def get_sql_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL database under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlDatabaseGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlDatabaseGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}'} + + + def _create_update_sql_database_initial( + self, resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_database_parameters, 'SqlDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_database( + self, resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param create_update_sql_database_parameters: The parameters to + provide for the current SQL database. + :type create_update_sql_database_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlDatabaseCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SqlDatabaseGetResults + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlDatabaseGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlDatabaseGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + create_update_sql_database_parameters=create_update_sql_database_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlDatabaseGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}'} + + + def _delete_sql_database_initial( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_database.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_database( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}'} + + def get_sql_database_throughput( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the SQL database under an existing Azure + Cosmos DB database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default'} + + + def _update_sql_database_throughput_initial( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_sql_database_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_sql_database_throughput( + self, resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param update_throughput_parameters: The parameters to provide for the + RUs per second of the current SQL database. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_sql_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_sql_database_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default'} + + def list_sql_containers( + self, resource_group_name, account_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlContainerGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlContainerGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlContainerGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_containers.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlContainerGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers'} + + def get_sql_container( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlContainerGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlContainerGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_container.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlContainerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'} + + + def _create_update_sql_container_initial( + self, resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_container.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_container_parameters, 'SqlContainerCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlContainerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_container( + self, resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param create_update_sql_container_parameters: The parameters to + provide for the current SQL container. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlContainerCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SqlContainerGetResults + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlContainerGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlContainerGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + create_update_sql_container_parameters=create_update_sql_container_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlContainerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'} + + + def _delete_sql_container_initial( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_container.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_container( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'} + + def get_sql_container_throughput( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the SQL container under an existing Azure + Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_container_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_container_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default'} + + + def _update_sql_container_throughput_initial( + self, resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_sql_container_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_sql_container_throughput( + self, resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param update_throughput_parameters: The parameters to provide for the + RUs per second of the current SQL container. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_sql_container_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_sql_container_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default'} + + def list_sql_stored_procedures( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL storedProcedure under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlStoredProcedureGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlStoredProcedureGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlStoredProcedureGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_stored_procedures.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlStoredProcedureGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_stored_procedures.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/'} + + def get_sql_stored_procedure( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL storedProcedure under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. + :type stored_procedure_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlStoredProcedureGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlStoredProcedureGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_stored_procedure.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'storedProcedureName': self._serialize.url("stored_procedure_name", stored_procedure_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlStoredProcedureGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_stored_procedure.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}'} + + + def _create_update_sql_stored_procedure_initial( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_stored_procedure.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'storedProcedureName': self._serialize.url("stored_procedure_name", stored_procedure_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_stored_procedure_parameters, 'SqlStoredProcedureCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlStoredProcedureGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_stored_procedure( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL storedProcedure. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters + to provide for the current SQL storedProcedure. + :type create_update_sql_stored_procedure_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlStoredProcedureCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + SqlStoredProcedureGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlStoredProcedureGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlStoredProcedureGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_stored_procedure_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, + create_update_sql_stored_procedure_parameters=create_update_sql_stored_procedure_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlStoredProcedureGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_stored_procedure.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}'} + + + def _delete_sql_stored_procedure_initial( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_stored_procedure.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'storedProcedureName': self._serialize.url("stored_procedure_name", stored_procedure_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_stored_procedure( + self, resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL storedProcedure. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. + :type stored_procedure_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_stored_procedure_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_stored_procedure.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}'} + + def list_sql_user_defined_functions( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL userDefinedFunction under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlUserDefinedFunctionGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlUserDefinedFunctionGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlUserDefinedFunctionGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_user_defined_functions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlUserDefinedFunctionGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_user_defined_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/'} + + def get_sql_user_defined_function( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL userDefinedFunction under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. + :type user_defined_function_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlUserDefinedFunctionGetResults or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlUserDefinedFunctionGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_user_defined_function.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'userDefinedFunctionName': self._serialize.url("user_defined_function_name", user_defined_function_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlUserDefinedFunctionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_user_defined_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}'} + + + def _create_update_sql_user_defined_function_initial( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_user_defined_function.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'userDefinedFunctionName': self._serialize.url("user_defined_function_name", user_defined_function_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_user_defined_function_parameters, 'SqlUserDefinedFunctionCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlUserDefinedFunctionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_user_defined_function( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL userDefinedFunction. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The + parameters to provide for the current SQL userDefinedFunction. + :type create_update_sql_user_defined_function_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlUserDefinedFunctionCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + SqlUserDefinedFunctionGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlUserDefinedFunctionGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlUserDefinedFunctionGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_user_defined_function_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, + create_update_sql_user_defined_function_parameters=create_update_sql_user_defined_function_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlUserDefinedFunctionGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_user_defined_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}'} + + + def _delete_sql_user_defined_function_initial( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_user_defined_function.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'userDefinedFunctionName': self._serialize.url("user_defined_function_name", user_defined_function_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_user_defined_function( + self, resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. + :type user_defined_function_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_user_defined_function_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_user_defined_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}'} + + def list_sql_triggers( + self, resource_group_name, account_name, database_name, container_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL trigger under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SqlTriggerGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlTriggerGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlTriggerGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sql_triggers.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SqlTriggerGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_sql_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/'} + + def get_sql_trigger( + self, resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers=None, raw=False, **operation_config): + """Gets the SQL trigger under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. + :type trigger_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SqlTriggerGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlTriggerGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_trigger.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'triggerName': self._serialize.url("trigger_name", trigger_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlTriggerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}'} + + + def _create_update_sql_trigger_initial( + self, resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_sql_trigger.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'triggerName': self._serialize.url("trigger_name", trigger_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_sql_trigger_parameters, 'SqlTriggerCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SqlTriggerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_trigger( + self, resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL trigger. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide + for the current SQL trigger. + :type create_update_sql_trigger_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlTriggerCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SqlTriggerGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlTriggerGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.SqlTriggerGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_trigger_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, + create_update_sql_trigger_parameters=create_update_sql_trigger_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlTriggerGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}'} + + + def _delete_sql_trigger_initial( + self, resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_trigger.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + 'triggerName': self._serialize.url("trigger_name", trigger_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_sql_trigger( + self, resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL trigger. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. + :type trigger_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_trigger_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_table_resources_operations.py new file mode 100644 index 000000000000..00fa12fd8e33 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/operations/_table_resources_operations.py @@ -0,0 +1,542 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class TableResourcesOperations(object): + """TableResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + + self.config = config + + def list_tables( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Tables under an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of TableGetResults + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TableGetResultsPaged[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TableGetResults] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_tables.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TableGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_tables.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables'} + + def get_table( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the Tables under an existing Azure Cosmos DB database account with + the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TableGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TableGetResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}'} + + + def _create_update_table_initial( + self, resource_group_name, account_name, table_name, create_update_table_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_update_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_table_parameters, 'TableCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_table( + self, resource_group_name, account_name, table_name, create_update_table_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for + the current Table. + :type create_update_table_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TableCreateUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns TableGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TableGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.TableGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + create_update_table_parameters=create_update_table_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('TableGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}'} + + + def _delete_table_initial( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_table.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_table( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}'} + + def get_table_throughput( + self, resource_group_name, account_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets the RUs per second of the Table under an existing Azure Cosmos DB + database account with the provided name. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ThroughputSettingsGetResults or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default'} + + + def _update_table_throughput_initial( + self, resource_group_name, account_name, table_name, update_throughput_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_table_throughput.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_table_throughput( + self, resource_group_name, account_name, table_name, update_throughput_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update RUs per second of an Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_name: Cosmos DB table name. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the + RUs per second of the current Table. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ThroughputSettingsGetResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.v2019_08_01_preview.models.ThroughputSettingsGetResults]] + :raises: :class:`CloudError` + """ + raw_result = self._update_table_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + update_throughput_parameters=update_throughput_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ThroughputSettingsGetResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_table_throughput.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default'} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/version.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/version.py new file mode 100644 index 000000000000..53a203f32aaf --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/v2019_08_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "" + diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_operations_mixin.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_operations_mixin.py index daab37000fc0..a6e9b68421bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_operations_mixin.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_operations_mixin.py @@ -38,4 +38,5 @@ def list_operations(self, custom_headers=None, raw=False, **operation_config): mixin_instance.config = self.config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + mixin_instance.api_version = api_version return mixin_instance.list_operations(custom_headers, raw, **operation_config) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py index bbc5ddf9bc76..2532fbe11404 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py @@ -61,10 +61,11 @@ def list_by_resource_group( $filter=substringof('demo', name)

You can link more than one substringof together by adding and/or operators.

You can filter by tag names and values. For example, to filter for a tag name and - value, use $filter=tagName eq 'tag1' and tagValue eq - 'Value1'

You can use some properties together when filtering. - The combinations you can use are: substringof and/or resourceType, - plan and plan/publisher and plan/name, identity and + value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When + you filter by a tag name and value, the tags for each resource are not + returned in the results.

You can use some properties together + when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. :type filter: str :param expand: The $expand query parameter. You can expand createdTime @@ -351,10 +352,11 @@ def list( $filter=substringof('demo', name)

You can link more than one substringof together by adding and/or operators.

You can filter by tag names and values. For example, to filter for a tag name and - value, use $filter=tagName eq 'tag1' and tagValue eq - 'Value1'

You can use some properties together when filtering. - The combinations you can use are: substringof and/or resourceType, - plan and plan/publisher and plan/name, identity and + value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When + you filter by a tag name and value, the tags for each resource are not + returned in the results.

You can use some properties together + when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. :type filter: str :param expand: The $expand query parameter. You can expand createdTime @@ -433,7 +435,7 @@ def internal_paging(next_link=None): list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} def check_existence( - self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): """Checks whether a resource exists. :param resource_group_name: The name of the resource group containing @@ -449,8 +451,6 @@ def check_existence( :param resource_name: The name of the resource to check whether it exists. :type resource_name: str - :param api_version: The API version to use for the operation. - :type api_version: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -474,7 +474,7 @@ def check_existence( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -503,7 +503,7 @@ def check_existence( def _delete_initial( - self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -518,7 +518,7 @@ def _delete_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -543,7 +543,7 @@ def _delete_initial( return client_raw_response def delete( - self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes a resource. :param resource_group_name: The name of the resource group that @@ -558,8 +558,6 @@ def delete( :type resource_type: str :param resource_name: The name of the resource to delete. :type resource_name: str - :param api_version: The API version to use for the operation. - :type api_version: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response @@ -577,7 +575,6 @@ def delete( parent_resource_path=parent_resource_path, resource_type=resource_type, resource_name=resource_name, - api_version=api_version, custom_headers=custom_headers, raw=True, **operation_config @@ -599,7 +596,7 @@ def get_long_running_output(response): def _create_or_update_initial( - self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -614,7 +611,7 @@ def _create_or_update_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -653,7 +650,7 @@ def _create_or_update_initial( return deserialized def create_or_update( - self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): """Creates a resource. :param resource_group_name: The name of the resource group for the @@ -668,8 +665,6 @@ def create_or_update( :type resource_type: str :param resource_name: The name of the resource to create. :type resource_name: str - :param api_version: The API version to use for the operation. - :type api_version: str :param parameters: Parameters for creating or updating the resource. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource @@ -692,7 +687,6 @@ def create_or_update( parent_resource_path=parent_resource_path, resource_type=resource_type, resource_name=resource_name, - api_version=api_version, parameters=parameters, custom_headers=custom_headers, raw=True, @@ -719,7 +713,7 @@ def get_long_running_output(response): def _update_initial( - self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -734,7 +728,7 @@ def _update_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -771,7 +765,7 @@ def _update_initial( return deserialized def update( - self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): """Updates a resource. :param resource_group_name: The name of the resource group for the @@ -786,8 +780,6 @@ def update( :type resource_type: str :param resource_name: The name of the resource to update. :type resource_name: str - :param api_version: The API version to use for the operation. - :type api_version: str :param parameters: Parameters for updating the resource. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource @@ -810,7 +802,6 @@ def update( parent_resource_path=parent_resource_path, resource_type=resource_type, resource_name=resource_name, - api_version=api_version, parameters=parameters, custom_headers=custom_headers, raw=True, @@ -836,7 +827,7 @@ def get_long_running_output(response): update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} def get( - self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): """Gets a resource. :param resource_group_name: The name of the resource group containing @@ -851,8 +842,6 @@ def get( :type resource_type: str :param resource_name: The name of the resource to get. :type resource_name: str - :param api_version: The API version to use for the operation. - :type api_version: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -878,7 +867,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -911,15 +900,13 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} def check_existence_by_id( - self, resource_id, api_version, custom_headers=None, raw=False, **operation_config): + self, resource_id, custom_headers=None, raw=False, **operation_config): """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} :type resource_id: str - :param api_version: The API version to use for the operation. - :type api_version: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -938,7 +925,7 @@ def check_existence_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -967,7 +954,7 @@ def check_existence_by_id( def _delete_by_id_initial( - self, resource_id, api_version, custom_headers=None, raw=False, **operation_config): + self, resource_id, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.delete_by_id.metadata['url'] path_format_arguments = { @@ -977,7 +964,7 @@ def _delete_by_id_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -1002,15 +989,13 @@ def _delete_by_id_initial( return client_raw_response def delete_by_id( - self, resource_id, api_version, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_id, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} :type resource_id: str - :param api_version: The API version to use for the operation. - :type api_version: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response @@ -1024,7 +1009,6 @@ def delete_by_id( """ raw_result = self._delete_by_id_initial( resource_id=resource_id, - api_version=api_version, custom_headers=custom_headers, raw=True, **operation_config @@ -1046,7 +1030,7 @@ def get_long_running_output(response): def _create_or_update_by_id_initial( - self, resource_id, api_version, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_id, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update_by_id.metadata['url'] path_format_arguments = { @@ -1056,7 +1040,7 @@ def _create_or_update_by_id_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -1095,15 +1079,13 @@ def _create_or_update_by_id_initial( return deserialized def create_or_update_by_id( - self, resource_id, api_version, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_id, parameters, custom_headers=None, raw=False, polling=True, **operation_config): """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} :type resource_id: str - :param api_version: The API version to use for the operation. - :type api_version: str :param parameters: Create or update resource parameters. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource @@ -1122,7 +1104,6 @@ def create_or_update_by_id( """ raw_result = self._create_or_update_by_id_initial( resource_id=resource_id, - api_version=api_version, parameters=parameters, custom_headers=custom_headers, raw=True, @@ -1149,7 +1130,7 @@ def get_long_running_output(response): def _update_by_id_initial( - self, resource_id, api_version, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_id, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.update_by_id.metadata['url'] path_format_arguments = { @@ -1159,7 +1140,7 @@ def _update_by_id_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -1196,15 +1177,13 @@ def _update_by_id_initial( return deserialized def update_by_id( - self, resource_id, api_version, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_id, parameters, custom_headers=None, raw=False, polling=True, **operation_config): """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} :type resource_id: str - :param api_version: The API version to use for the operation. - :type api_version: str :param parameters: Update resource parameters. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource @@ -1223,7 +1202,6 @@ def update_by_id( """ raw_result = self._update_by_id_initial( resource_id=resource_id, - api_version=api_version, parameters=parameters, custom_headers=custom_headers, raw=True, @@ -1249,15 +1227,13 @@ def get_long_running_output(response): update_by_id.metadata = {'url': '/{resourceId}'} def get_by_id( - self, resource_id, api_version, custom_headers=None, raw=False, **operation_config): + self, resource_id, custom_headers=None, raw=False, **operation_config): """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} :type resource_id: str - :param api_version: The API version to use for the operation. - :type api_version: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1278,7 +1254,7 @@ def get_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {}