diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db.py index eea6f9184e6d..d3f871755156 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db.py @@ -26,6 +26,11 @@ 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 @@ -61,6 +66,16 @@ class CosmosDB(SDKClient): :vartype partition_key_range_id: azure.mgmt.cosmosdb.operations.PartitionKeyRangeIdOperations :ivar partition_key_range_id_region: PartitionKeyRangeIdRegion operations :vartype partition_key_range_id_region: azure.mgmt.cosmosdb.operations.PartitionKeyRangeIdRegionOperations + :ivar sql_resources: SqlResources operations + :vartype sql_resources: azure.mgmt.cosmosdb.operations.SqlResourcesOperations + :ivar mongo_db_resources: MongoDBResources operations + :vartype mongo_db_resources: azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations + :ivar table_resources: TableResources operations + :vartype table_resources: azure.mgmt.cosmosdb.operations.TableResourcesOperations + :ivar cassandra_resources: CassandraResources operations + :vartype cassandra_resources: azure.mgmt.cosmosdb.operations.CassandraResourcesOperations + :ivar gremlin_resources: GremlinResources operations + :vartype gremlin_resources: azure.mgmt.cosmosdb.operations.GremlinResourcesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -77,7 +92,7 @@ def __init__( 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.api_version = '2019-08-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -107,3 +122,13 @@ def __init__( 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/models/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py index a7f22fd3cc55..a583503a43bd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py @@ -10,23 +10,25 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import ARMProxyResource + from ._models_py3 import ARMResourceProperties from ._models_py3 import Capability - from ._models_py3 import CassandraKeyspace 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 CassandraTable 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 DatabaseAccount 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 @@ -37,11 +39,11 @@ 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 GremlinDatabaseGetResults from ._models_py3 import GremlinDatabaseResource - from ._models_py3 import GremlinGraph 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 @@ -52,11 +54,11 @@ 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 MongoDBCollectionGetResults from ._models_py3 import MongoDBCollectionResource - from ._models_py3 import MongoDBDatabase 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 @@ -68,41 +70,51 @@ 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 SqlContainerGetResults from ._models_py3 import SqlContainerResource - from ._models_py3 import SqlDatabase from ._models_py3 import SqlDatabaseCreateUpdateParameters + from ._models_py3 import SqlDatabaseGetResults from ._models_py3 import SqlDatabaseResource - from ._models_py3 import Table + 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 Throughput - from ._models_py3 import ThroughputResource - from ._models_py3 import ThroughputUpdateParameters + 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 CassandraKeyspace from ._models import CassandraKeyspaceCreateUpdateParameters + from ._models import CassandraKeyspaceGetResults from ._models import CassandraKeyspaceResource from ._models import CassandraPartitionKey from ._models import CassandraSchema - from ._models import CassandraTable 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 DatabaseAccount from ._models import DatabaseAccountConnectionString from ._models import DatabaseAccountCreateUpdateParameters + from ._models import DatabaseAccountGetResults from ._models import DatabaseAccountListConnectionStringsResult from ._models import DatabaseAccountListKeysResult from ._models import DatabaseAccountListReadOnlyKeysResult @@ -113,11 +125,11 @@ from ._models import ExtendedResourceProperties from ._models import FailoverPolicies from ._models import FailoverPolicy - from ._models import GremlinDatabase from ._models import GremlinDatabaseCreateUpdateParameters + from ._models import GremlinDatabaseGetResults from ._models import GremlinDatabaseResource - from ._models import GremlinGraph from ._models import GremlinGraphCreateUpdateParameters + from ._models import GremlinGraphGetResults from ._models import GremlinGraphResource from ._models import IncludedPath from ._models import Indexes @@ -128,11 +140,11 @@ from ._models import MetricDefinition from ._models import MetricName from ._models import MetricValue - from ._models import MongoDBCollection from ._models import MongoDBCollectionCreateUpdateParameters + from ._models import MongoDBCollectionGetResults from ._models import MongoDBCollectionResource - from ._models import MongoDBDatabase from ._models import MongoDBDatabaseCreateUpdateParameters + from ._models import MongoDBDatabaseGetResults from ._models import MongoDBDatabaseResource from ._models import MongoIndex from ._models import MongoIndexKeys @@ -144,39 +156,50 @@ 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 SqlContainerGetResults from ._models import SqlContainerResource - from ._models import SqlDatabase from ._models import SqlDatabaseCreateUpdateParameters + from ._models import SqlDatabaseGetResults from ._models import SqlDatabaseResource - from ._models import Table + 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 Throughput - from ._models import ThroughputResource - from ._models import ThroughputUpdateParameters + 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 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 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 MongoDBCollectionPaged -from ._paged_models import MongoDBDatabasePaged +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 SqlContainerPaged -from ._paged_models import SqlDatabasePaged -from ._paged_models import TablePaged +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, @@ -188,29 +211,33 @@ IndexKind, PartitionKind, ConflictResolutionMode, + TriggerType, + TriggerOperation, KeyKind, UnitType, PrimaryAggregationType, ) __all__ = [ + 'ARMProxyResource', + 'ARMResourceProperties', 'Capability', - 'CassandraKeyspace', 'CassandraKeyspaceCreateUpdateParameters', + 'CassandraKeyspaceGetResults', 'CassandraKeyspaceResource', 'CassandraPartitionKey', 'CassandraSchema', - 'CassandraTable', 'CassandraTableCreateUpdateParameters', + 'CassandraTableGetResults', 'CassandraTableResource', 'ClusterKey', 'Column', 'ConflictResolutionPolicy', 'ConsistencyPolicy', 'ContainerPartitionKey', - 'DatabaseAccount', 'DatabaseAccountConnectionString', 'DatabaseAccountCreateUpdateParameters', + 'DatabaseAccountGetResults', 'DatabaseAccountListConnectionStringsResult', 'DatabaseAccountListKeysResult', 'DatabaseAccountListReadOnlyKeysResult', @@ -221,11 +248,11 @@ 'ExtendedResourceProperties', 'FailoverPolicies', 'FailoverPolicy', - 'GremlinDatabase', 'GremlinDatabaseCreateUpdateParameters', + 'GremlinDatabaseGetResults', 'GremlinDatabaseResource', - 'GremlinGraph', 'GremlinGraphCreateUpdateParameters', + 'GremlinGraphGetResults', 'GremlinGraphResource', 'IncludedPath', 'Indexes', @@ -236,11 +263,11 @@ 'MetricDefinition', 'MetricName', 'MetricValue', - 'MongoDBCollection', 'MongoDBCollectionCreateUpdateParameters', + 'MongoDBCollectionGetResults', 'MongoDBCollectionResource', - 'MongoDBDatabase', 'MongoDBDatabaseCreateUpdateParameters', + 'MongoDBDatabaseGetResults', 'MongoDBDatabaseResource', 'MongoIndex', 'MongoIndexKeys', @@ -252,40 +279,51 @@ 'PercentileMetric', 'PercentileMetricValue', 'RegionForOnlineOffline', - 'Resource', - 'SqlContainer', 'SqlContainerCreateUpdateParameters', + 'SqlContainerGetResults', 'SqlContainerResource', - 'SqlDatabase', 'SqlDatabaseCreateUpdateParameters', + 'SqlDatabaseGetResults', 'SqlDatabaseResource', - 'Table', + 'SqlStoredProcedureCreateUpdateParameters', + 'SqlStoredProcedureGetResults', + 'SqlStoredProcedureResource', + 'SqlTriggerCreateUpdateParameters', + 'SqlTriggerGetResults', + 'SqlTriggerResource', + 'SqlUserDefinedFunctionCreateUpdateParameters', + 'SqlUserDefinedFunctionGetResults', + 'SqlUserDefinedFunctionResource', 'TableCreateUpdateParameters', + 'TableGetResults', 'TableResource', - 'Throughput', - 'ThroughputResource', - 'ThroughputUpdateParameters', + 'ThroughputSettingsGetResults', + 'ThroughputSettingsResource', + 'ThroughputSettingsUpdateParameters', 'UniqueKey', 'UniqueKeyPolicy', 'Usage', 'VirtualNetworkRule', - 'DatabaseAccountPaged', + 'DatabaseAccountGetResultsPaged', 'MetricPaged', 'UsagePaged', 'MetricDefinitionPaged', - 'SqlDatabasePaged', - 'SqlContainerPaged', - 'MongoDBDatabasePaged', - 'MongoDBCollectionPaged', - 'TablePaged', - 'CassandraKeyspacePaged', - 'CassandraTablePaged', - 'GremlinDatabasePaged', - 'GremlinGraphPaged', 'OperationPaged', 'PercentileMetricPaged', 'PartitionMetricPaged', 'PartitionUsagePaged', + 'SqlDatabaseGetResultsPaged', + 'SqlContainerGetResultsPaged', + 'SqlStoredProcedureGetResultsPaged', + 'SqlUserDefinedFunctionGetResultsPaged', + 'SqlTriggerGetResultsPaged', + 'MongoDBDatabaseGetResultsPaged', + 'MongoDBCollectionGetResultsPaged', + 'TableGetResultsPaged', + 'CassandraKeyspaceGetResultsPaged', + 'CassandraTableGetResultsPaged', + 'GremlinDatabaseGetResultsPaged', + 'GremlinGraphGetResultsPaged', 'DatabaseAccountKind', 'DatabaseAccountOfferType', 'DefaultConsistencyLevel', @@ -295,6 +333,8 @@ 'IndexKind', 'PartitionKind', 'ConflictResolutionMode', + 'TriggerType', + 'TriggerOperation', 'KeyKind', 'UnitType', 'PrimaryAggregationType', diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_enums.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_enums.py index ae8c501d4108..0386fbe056dc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_enums.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_enums.py @@ -74,6 +74,21 @@ class ConflictResolutionMode(str, Enum): 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" @@ -98,6 +113,6 @@ class PrimaryAggregationType(str, Enum): none = "None" average = "Average" total = "Total" - minimimum = "Minimimum" + minimum = "Minimum" maximum = "Maximum" last = "Last" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py index 62d5d9dea87f..86d20f11a3f6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py @@ -13,33 +13,49 @@ from msrest.exceptions import HttpOperationError -class Capability(Model): - """Cosmos DB capability object. +class ARMProxyResource(Model): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. - :param name: Name of the Cosmos DB capability. For example, "name": - "EnableCassandra". Current values also include "EnableTable" and - "EnableGremlin". - :type name: str + 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(Capability, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + super(ARMProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class Resource(Model): +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -65,7 +81,7 @@ class Resource(Model): } def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) + super(ARMResourceProperties, self).__init__(**kwargs) self.id = None self.name = None self.type = None @@ -73,17 +89,35 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class CassandraKeyspace(Resource): - """An Azure Cosmos DB Cassandra keyspace. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -92,16 +126,20 @@ class CassandraKeyspace(Resource): :type location: str :param tags: :type tags: dict[str, str] - :param cassandra_keyspace_id: Required. Name of the Cosmos DB Cassandra + :param resource: Required. The standard JSON format of a Cassandra keyspace - :type cassandra_keyspace_id: str + :type resource: ~azure.mgmt.cosmosdb.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}, - 'cassandra_keyspace_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -110,45 +148,80 @@ class CassandraKeyspace(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'cassandra_keyspace_id': {'key': 'properties.id', 'type': 'str'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, } def __init__(self, **kwargs): - super(CassandraKeyspace, self).__init__(**kwargs) - self.cassandra_keyspace_id = kwargs.get('cassandra_keyspace_id', None) + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) -class CassandraKeyspaceCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB Cassandra keyspace. +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. - :param resource: Required. The standard JSON format of a Cassandra - keyspace - :type resource: ~azure.mgmt.cosmosdb.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] + :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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) - self.resource = kwargs.get('resource', None) - self.options = kwargs.get('options', None) + 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 id object. + """Cosmos DB Cassandra keyspace resource object. All required parameters must be populated in order to send to Azure. @@ -210,17 +283,17 @@ def __init__(self, **kwargs): self.cluster_keys = kwargs.get('cluster_keys', None) -class CassandraTable(Resource): - """An Azure Cosmos DB Cassandra table. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -229,19 +302,19 @@ class CassandraTable(Resource): :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.models.CassandraSchema + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: ~azure.mgmt.cosmosdb.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}, - 'cassandra_table_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -250,48 +323,88 @@ class CassandraTable(Resource): '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'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, } 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) + super(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) -class CassandraTableCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB Cassandra table. +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. - :param resource: Required. The standard JSON format of a Cassandra table - :type resource: ~azure.mgmt.cosmosdb.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] + :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.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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) - self.resource = kwargs.get('resource', None) - self.options = kwargs.get('options', None) + 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 id object. + """Cosmos DB Cassandra table resource object. All required parameters must be populated in order to send to Azure. @@ -461,15 +574,45 @@ def __init__(self, **kwargs): self.kind = kwargs.get('kind', "Hash") -class DatabaseAccount(Resource): - """An Azure Cosmos DB database account. +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 id: The unique resource identifier of the database account. + :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 database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -482,16 +625,15 @@ class DatabaseAccount(Resource): at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . :type kind: str or ~azure.mgmt.cosmosdb.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.models.DatabaseAccountOfferType + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :param locations: Required. An array that contains the georeplication + locations enabled for the Cosmos DB account. + :type locations: list[~azure.mgmt.cosmosdb.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 @@ -505,21 +647,8 @@ class DatabaseAccount(Resource): 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.models.ConsistencyPolicy :param capabilities: List of Cosmos DB capabilities for the account :type capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :ivar write_locations: An array that contains the write location for the - Cosmos DB account. - :vartype write_locations: list[~azure.mgmt.cosmosdb.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.models.Location] - :ivar failover_policies: An array that contains the regions ordered by - their failover priorities. - :vartype failover_policies: - list[~azure.mgmt.cosmosdb.models.FailoverPolicy] :param virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB account. :type virtual_network_rules: @@ -539,11 +668,8 @@ class DatabaseAccount(Resource): '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}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, } _attribute_map = { @@ -553,82 +679,45 @@ class DatabaseAccount(Resource): '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'}, + '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'}, - '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'}, } + database_account_offer_type = "Standard" + def __init__(self, **kwargs): - super(DatabaseAccount, self).__init__(**kwargs) + super(DatabaseAccountCreateUpdateParameters, 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.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.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. +class DatabaseAccountGetResults(ARMResourceProperties): + """An Azure Cosmos DB database account. 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. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -641,15 +730,16 @@ class DatabaseAccountCreateUpdateParameters(Resource): at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . :type kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :param consistency_policy: The consistency policy for the Cosmos DB - account. - :type consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :param locations: Required. An array that contains the georeplication - locations enabled for the Cosmos DB account. - :type locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar database_account_offer_type: Required. The offer type for the - database. Default value: "Standard" . - :vartype database_account_offer_type: str + :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.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 @@ -663,8 +753,21 @@ class DatabaseAccountCreateUpdateParameters(Resource): 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.models.ConsistencyPolicy :param capabilities: List of Cosmos DB capabilities for the account :type capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :ivar write_locations: An array that contains the write location for the + Cosmos DB account. + :vartype write_locations: list[~azure.mgmt.cosmosdb.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.models.Location] + :ivar failover_policies: An array that contains the regions ordered by + their failover priorities. + :vartype failover_policies: + list[~azure.mgmt.cosmosdb.models.FailoverPolicy] :param virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB account. :type virtual_network_rules: @@ -684,8 +787,11 @@ class DatabaseAccountCreateUpdateParameters(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'locations': {'required': True}, - 'database_account_offer_type': {'required': True, 'constant': 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 = { @@ -695,30 +801,37 @@ class DatabaseAccountCreateUpdateParameters(Resource): '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'}, + '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'}, } - database_account_offer_type = "Standard" - def __init__(self, **kwargs): - super(DatabaseAccountCreateUpdateParameters, self).__init__(**kwargs) + super(DatabaseAccountGetResults, self).__init__(**kwargs) self.kind = kwargs.get('kind', "GlobalDocumentDB") - self.consistency_policy = kwargs.get('consistency_policy', None) - self.locations = kwargs.get('locations', None) + 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) @@ -906,19 +1019,28 @@ def __init__(self, **kwargs): class ExtendedResourceProperties(Model): - """The system generated resource properties associated with SQL databases and - SQL containers. + """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. - :param _rid: A system generated property. A unique identifier. - :type _rid: str - :param _ts: A system generated property that denotes the last updated + :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. - :type _ts: object - :param _etag: A system generated property representing the resource etag + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag required for optimistic concurrency control. - :type _etag: str + :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'}, @@ -927,9 +1049,9 @@ class ExtendedResourceProperties(Model): 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) + self._rid = None + self._ts = None + self._etag = None class FailoverPolicies(Model): @@ -991,17 +1113,17 @@ def __init__(self, **kwargs): self.failover_priority = kwargs.get('failover_priority', None) -class GremlinDatabase(Resource): - """An Azure Cosmos DB Gremlin database. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -1010,24 +1132,19 @@ class GremlinDatabase(Resource): :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 + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: ~azure.mgmt.cosmosdb.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}, - 'gremlin_database_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -1036,50 +1153,80 @@ class GremlinDatabase(Resource): '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'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', '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) + super(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) -class GremlinDatabaseCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB Gremlin database. +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. - :param resource: Required. The standard JSON format of a Gremlin database - :type resource: ~azure.mgmt.cosmosdb.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] + :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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) - self.resource = kwargs.get('resource', None) - self.options = kwargs.get('options', None) + 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 id object. + """Cosmos DB Gremlin database resource object. All required parameters must be populated in order to send to Azure. @@ -1100,7 +1247,57 @@ def __init__(self, **kwargs): self.id = kwargs.get('id', None) -class GremlinGraph(Resource): +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.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 @@ -1108,9 +1305,9 @@ class GremlinGraph(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -1119,8 +1316,9 @@ class GremlinGraph(Resource): :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 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.models.IndexingPolicy @@ -1137,21 +1335,24 @@ class GremlinGraph(Resource): graph. :type conflict_resolution_policy: ~azure.mgmt.cosmosdb.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 + :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. - :type _ts: object - :param _etag: A system generated property representing the resource etag + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag required for optimistic concurrency control. - :type _etag: str + :vartype _etag: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'gremlin_graph_id': {'required': True}, + 'gremlin_graph_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, } _attribute_map = { @@ -1160,7 +1361,7 @@ class GremlinGraph(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'gremlin_graph_id': {'key': 'properties.id', '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'}, @@ -1172,44 +1373,16 @@ class GremlinGraph(Resource): } def __init__(self, **kwargs): - super(GremlinGraph, self).__init__(**kwargs) - self.gremlin_graph_id = kwargs.get('gremlin_graph_id', None) + 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 = 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.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) + self._rid = None + self._ts = None + self._etag = None class GremlinGraphResource(Model): @@ -1480,7 +1653,7 @@ class MetricDefinition(Model): :vartype metric_availabilities: list[~azure.mgmt.cosmosdb.models.MetricAvailability] :ivar primary_aggregation_type: The primary aggregation type of the - metric. Possible values include: 'None', 'Average', 'Total', 'Minimimum', + metric. Possible values include: 'None', 'Average', 'Total', 'Minimum', 'Maximum', 'Last' :vartype primary_aggregation_type: str or ~azure.mgmt.cosmosdb.models.PrimaryAggregationType @@ -1594,17 +1767,17 @@ def __init__(self, **kwargs): self.total = None -class MongoDBCollection(Resource): - """An Azure Cosmos DB MongoDB collection. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -1613,21 +1786,20 @@ class MongoDBCollection(Resource): :type location: str :param tags: :type tags: dict[str, str] - :param mongo_db_collection_id: Required. Name of the Cosmos DB MongoDB + :param resource: Required. The standard JSON format of a 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.models.MongoIndex] + :type resource: ~azure.mgmt.cosmosdb.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}, - 'mongo_db_collection_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -1636,45 +1808,85 @@ class MongoDBCollection(Resource): '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]'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, } 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) + super(MongoDBCollectionCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) -class MongoDBCollectionCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB MongoDB collection. +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. - :param resource: Required. The standard JSON format of a MongoDB - collection - :type resource: ~azure.mgmt.cosmosdb.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] + :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.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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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(MongoDBCollectionCreateUpdateParameters, self).__init__(**kwargs) - self.resource = kwargs.get('resource', None) - self.options = kwargs.get('options', None) + 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): @@ -1708,17 +1920,17 @@ def __init__(self, **kwargs): self.indexes = kwargs.get('indexes', None) -class MongoDBDatabase(Resource): - """An Azure Cosmos DB MongoDB database. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -1727,16 +1939,19 @@ class MongoDBDatabase(Resource): :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 + :param resource: Required. The standard JSON format of a MongoDB database + :type resource: ~azure.mgmt.cosmosdb.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}, - 'mongo_db_database_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -1745,44 +1960,80 @@ class MongoDBDatabase(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'mongo_db_database_id': {'key': 'properties.id', 'type': 'str'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, } def __init__(self, **kwargs): - super(MongoDBDatabase, self).__init__(**kwargs) - self.mongo_db_database_id = kwargs.get('mongo_db_database_id', None) + super(MongoDBDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) -class MongoDBDatabaseCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB MongoDB database. +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. - :param resource: Required. The standard JSON format of a MongoDB database - :type resource: ~azure.mgmt.cosmosdb.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] + :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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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(MongoDBDatabaseCreateUpdateParameters, self).__init__(**kwargs) - self.resource = kwargs.get('resource', None) - self.options = kwargs.get('options', None) + 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 id object. + """Cosmos DB MongoDB database resource object. All required parameters must be populated in order to send to Azure. @@ -2212,7 +2463,57 @@ def __init__(self, **kwargs): self.region = kwargs.get('region', None) -class SqlContainer(Resource): +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.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 @@ -2220,9 +2521,9 @@ class SqlContainer(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -2231,8 +2532,9 @@ class SqlContainer(Resource): :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 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 @@ -2250,21 +2552,24 @@ class SqlContainer(Resource): container. :type conflict_resolution_policy: ~azure.mgmt.cosmosdb.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 + :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. - :type _ts: object - :param _etag: A system generated property representing the resource etag + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag required for optimistic concurrency control. - :type _etag: str + :vartype _etag: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'sql_container_id': {'required': True}, + 'sql_container_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, } _attribute_map = { @@ -2273,7 +2578,7 @@ class SqlContainer(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'sql_container_id': {'key': 'properties.id', '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'}, @@ -2285,44 +2590,16 @@ class SqlContainer(Resource): } def __init__(self, **kwargs): - super(SqlContainer, self).__init__(**kwargs) - self.sql_container_id = kwargs.get('sql_container_id', None) + 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 = 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.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) + self._rid = None + self._ts = None + self._etag = None class SqlContainerResource(Model): @@ -2374,7 +2651,57 @@ def __init__(self, **kwargs): self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) -class SqlDatabase(Resource): +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.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 @@ -2382,9 +2709,9 @@ class SqlDatabase(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -2393,16 +2720,17 @@ class SqlDatabase(Resource): :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 + :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. - :type _ts: object - :param _etag: A system generated property representing the resource etag + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag required for optimistic concurrency control. - :type _etag: str + :vartype _etag: str :param _colls: A system generated property that specified the addressable path of the collections resource. :type _colls: str @@ -2415,7 +2743,10 @@ class SqlDatabase(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'sql_database_id': {'required': True}, + 'sql_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, } _attribute_map = { @@ -2424,7 +2755,7 @@ class SqlDatabase(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'sql_database_id': {'key': 'properties.id', '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'}, @@ -2433,50 +2764,162 @@ class SqlDatabase(Resource): } 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) + 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 SqlDatabaseCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB SQL database. +class SqlDatabaseResource(Model): + """Cosmos DB SQL database resource object. 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.models.SqlDatabaseResource + :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.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 = { - 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, + '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(SqlDatabaseCreateUpdateParameters, self).__init__(**kwargs) + super(SqlStoredProcedureCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs.get('resource', None) self.options = kwargs.get('options', None) -class SqlDatabaseResource(Model): - """Cosmos DB SQL database id object. +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. - :param id: Required. Name of the Cosmos DB SQL database + :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 = { @@ -2485,24 +2928,76 @@ class SqlDatabaseResource(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, } def __init__(self, **kwargs): - super(SqlDatabaseResource, self).__init__(**kwargs) + super(SqlStoredProcedureResource, self).__init__(**kwargs) self.id = kwargs.get('id', None) + self.body = kwargs.get('body', None) -class Table(Resource): - """An Azure Cosmos DB Table. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :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.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 @@ -2511,15 +3006,36 @@ class Table(Resource): :type location: str :param tags: :type tags: dict[str, str] - :param table_id: Required. Name of the Cosmos DB table - :type table_id: 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.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.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}, - 'table_id': {'required': True}, + 'sql_trigger_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, } _attribute_map = { @@ -2528,19 +3044,225 @@ class Table(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'table_id': {'key': 'properties.id', '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.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.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(Table, self).__init__(**kwargs) - self.table_id = kwargs.get('table_id', None) + 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. -class TableCreateUpdateParameters(Model): + :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.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.models.TableResource :param options: Required. A key-value pair of options to be applied for @@ -2549,11 +3271,19 @@ class TableCreateUpdateParameters(Model): """ _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}'}, } @@ -2564,8 +3294,69 @@ def __init__(self, **kwargs): 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 id object. + """Cosmos DB table resource object. All required parameters must be populated in order to send to Azure. @@ -2586,7 +3377,7 @@ def __init__(self, **kwargs): self.id = kwargs.get('id', None) -class Throughput(Resource): +class ThroughputSettingsGetResults(ARMResourceProperties): """An Azure Cosmos DB resource throughput. Variables are only populated by the server, and will be ignored when @@ -2594,9 +3385,9 @@ class Throughput(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -2607,6 +3398,10 @@ class Throughput(Resource): :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 = { @@ -2614,6 +3409,8 @@ class Throughput(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, } _attribute_map = { @@ -2623,55 +3420,94 @@ class Throughput(Resource): '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(Throughput, self).__init__(**kwargs) + super(ThroughputSettingsGetResults, self).__init__(**kwargs) self.throughput = kwargs.get('throughput', None) + self.minimum_throughput = None + self.offer_replace_pending = None -class ThroughputResource(Model): +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(ThroughputResource, self).__init__(**kwargs) + super(ThroughputSettingsResource, self).__init__(**kwargs) self.throughput = kwargs.get('throughput', None) + self.minimum_throughput = None + self.offer_replace_pending = None -class ThroughputUpdateParameters(Model): +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.models.ThroughputResource + :type resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource """ _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'resource': {'required': True}, } _attribute_map = { - 'resource': {'key': 'properties.resource', 'type': 'ThroughputResource'}, + '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(ThroughputUpdateParameters, self).__init__(**kwargs) + super(ThroughputSettingsUpdateParameters, self).__init__(**kwargs) self.resource = kwargs.get('resource', None) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py index a42d3f576f56..6e7275a122a5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py @@ -13,33 +13,49 @@ from msrest.exceptions import HttpOperationError -class Capability(Model): - """Cosmos DB capability object. +class ARMProxyResource(Model): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. - :param name: Name of the Cosmos DB capability. For example, "name": - "EnableCassandra". Current values also include "EnableTable" and - "EnableGremlin". - :type name: str + 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, *, name: str=None, **kwargs) -> None: - super(Capability, self).__init__(**kwargs) - self.name = name + def __init__(self, **kwargs) -> None: + super(ARMProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class Resource(Model): +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -65,7 +81,7 @@ class Resource(Model): } def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) + super(ARMResourceProperties, self).__init__(**kwargs) self.id = None self.name = None self.type = None @@ -73,17 +89,35 @@ def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: self.tags = tags -class CassandraKeyspace(Resource): - """An Azure Cosmos DB Cassandra keyspace. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -92,16 +126,20 @@ class CassandraKeyspace(Resource): :type location: str :param tags: :type tags: dict[str, str] - :param cassandra_keyspace_id: Required. Name of the Cosmos DB Cassandra + :param resource: Required. The standard JSON format of a Cassandra keyspace - :type cassandra_keyspace_id: str + :type resource: ~azure.mgmt.cosmosdb.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}, - 'cassandra_keyspace_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -110,45 +148,80 @@ class CassandraKeyspace(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'cassandra_keyspace_id': {'key': 'properties.id', 'type': 'str'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', '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 + 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. -class CassandraKeyspaceCreateUpdateParameters(Model): - """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. - :param resource: Required. The standard JSON format of a Cassandra - keyspace - :type resource: ~azure.mgmt.cosmosdb.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] + :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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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, *, resource, options, **kwargs) -> None: - super(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) - self.resource = resource - self.options = options + 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 id object. + """Cosmos DB Cassandra keyspace resource object. All required parameters must be populated in order to send to Azure. @@ -210,17 +283,17 @@ def __init__(self, *, columns=None, partition_keys=None, cluster_keys=None, **kw self.cluster_keys = cluster_keys -class CassandraTable(Resource): - """An Azure Cosmos DB Cassandra table. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -229,19 +302,19 @@ class CassandraTable(Resource): :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.models.CassandraSchema + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: ~azure.mgmt.cosmosdb.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}, - 'cassandra_table_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -250,48 +323,88 @@ class CassandraTable(Resource): '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'}, + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, } - 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 + 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 CassandraTableCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB Cassandra table. +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. - :param resource: Required. The standard JSON format of a Cassandra table - :type resource: ~azure.mgmt.cosmosdb.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] + :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.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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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, *, resource, options, **kwargs) -> None: - super(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) - self.resource = resource - self.options = options + 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 id object. + """Cosmos DB Cassandra table resource object. All required parameters must be populated in order to send to Azure. @@ -461,15 +574,45 @@ def __init__(self, *, paths=None, kind="Hash", **kwargs) -> None: self.kind = kind -class DatabaseAccount(Resource): - """An Azure Cosmos DB database account. +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 id: The unique resource identifier of the database account. + :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 database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -482,16 +625,15 @@ class DatabaseAccount(Resource): at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . :type kind: str or ~azure.mgmt.cosmosdb.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.models.DatabaseAccountOfferType + :param consistency_policy: The consistency policy for the Cosmos DB + account. + :type consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :param locations: Required. An array that contains the georeplication + locations enabled for the Cosmos DB account. + :type locations: list[~azure.mgmt.cosmosdb.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 @@ -505,21 +647,8 @@ class DatabaseAccount(Resource): 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.models.ConsistencyPolicy :param capabilities: List of Cosmos DB capabilities for the account :type capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :ivar write_locations: An array that contains the write location for the - Cosmos DB account. - :vartype write_locations: list[~azure.mgmt.cosmosdb.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.models.Location] - :ivar failover_policies: An array that contains the regions ordered by - their failover priorities. - :vartype failover_policies: - list[~azure.mgmt.cosmosdb.models.FailoverPolicy] :param virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB account. :type virtual_network_rules: @@ -539,11 +668,8 @@ class DatabaseAccount(Resource): '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}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, } _attribute_map = { @@ -553,82 +679,45 @@ class DatabaseAccount(Resource): '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'}, + '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'}, - '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) + 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.provisioning_state = provisioning_state - self.document_endpoint = None - self.database_account_offer_type = None + 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.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. +class DatabaseAccountGetResults(ARMResourceProperties): + """An Azure Cosmos DB database account. 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. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -641,15 +730,16 @@ class DatabaseAccountCreateUpdateParameters(Resource): at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . :type kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :param consistency_policy: The consistency policy for the Cosmos DB - account. - :type consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :param locations: Required. An array that contains the georeplication - locations enabled for the Cosmos DB account. - :type locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar database_account_offer_type: Required. The offer type for the - database. Default value: "Standard" . - :vartype database_account_offer_type: str + :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.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 @@ -663,8 +753,21 @@ class DatabaseAccountCreateUpdateParameters(Resource): 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.models.ConsistencyPolicy :param capabilities: List of Cosmos DB capabilities for the account :type capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :ivar write_locations: An array that contains the write location for the + Cosmos DB account. + :vartype write_locations: list[~azure.mgmt.cosmosdb.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.models.Location] + :ivar failover_policies: An array that contains the regions ordered by + their failover priorities. + :vartype failover_policies: + list[~azure.mgmt.cosmosdb.models.FailoverPolicy] :param virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB account. :type virtual_network_rules: @@ -684,8 +787,11 @@ class DatabaseAccountCreateUpdateParameters(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'locations': {'required': True}, - 'database_account_offer_type': {'required': True, 'constant': 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 = { @@ -695,30 +801,37 @@ class DatabaseAccountCreateUpdateParameters(Resource): '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'}, + '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'}, } - 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) + 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(DatabaseAccountGetResults, self).__init__(location=location, tags=tags, **kwargs) self.kind = kind - self.consistency_policy = consistency_policy - self.locations = locations + 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 @@ -906,30 +1019,39 @@ def __init__(self, *, path: str=None, **kwargs) -> None: class ExtendedResourceProperties(Model): - """The system generated resource properties associated with SQL databases and - SQL containers. + """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. - :param _rid: A system generated property. A unique identifier. - :type _rid: str - :param _ts: A system generated property that denotes the last updated + :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. - :type _ts: object - :param _etag: A system generated property representing the resource etag + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag required for optimistic concurrency control. - :type _etag: str + :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, *, _rid: str=None, _ts=None, _etag: str=None, **kwargs) -> None: + def __init__(self, **kwargs) -> None: super(ExtendedResourceProperties, self).__init__(**kwargs) - self._rid = _rid - self._ts = _ts - self._etag = _etag + self._rid = None + self._ts = None + self._etag = None class FailoverPolicies(Model): @@ -991,17 +1113,17 @@ def __init__(self, *, location_name: str=None, failover_priority: int=None, **kw self.failover_priority = failover_priority -class GremlinDatabase(Resource): - """An Azure Cosmos DB Gremlin database. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -1010,24 +1132,19 @@ class GremlinDatabase(Resource): :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 + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: ~azure.mgmt.cosmosdb.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}, - 'gremlin_database_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -1036,50 +1153,80 @@ class GremlinDatabase(Resource): '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'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', '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 + 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 GremlinDatabaseCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB Gremlin database. +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. - :param resource: Required. The standard JSON format of a Gremlin database - :type resource: ~azure.mgmt.cosmosdb.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] + :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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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, *, resource, options, **kwargs) -> None: - super(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) - self.resource = resource - self.options = options + 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 id object. + """Cosmos DB Gremlin database resource object. All required parameters must be populated in order to send to Azure. @@ -1100,7 +1247,57 @@ def __init__(self, *, id: str, **kwargs) -> None: self.id = id -class GremlinGraph(Resource): +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.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 @@ -1108,9 +1305,9 @@ class GremlinGraph(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -1119,8 +1316,9 @@ class GremlinGraph(Resource): :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 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.models.IndexingPolicy @@ -1137,21 +1335,24 @@ class GremlinGraph(Resource): graph. :type conflict_resolution_policy: ~azure.mgmt.cosmosdb.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 + :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. - :type _ts: object - :param _etag: A system generated property representing the resource etag + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag required for optimistic concurrency control. - :type _etag: str + :vartype _etag: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'gremlin_graph_id': {'required': True}, + 'gremlin_graph_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, } _attribute_map = { @@ -1160,7 +1361,7 @@ class GremlinGraph(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'gremlin_graph_id': {'key': 'properties.id', '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'}, @@ -1171,45 +1372,17 @@ class GremlinGraph(Resource): '_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 + 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 = _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.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 + self._rid = None + self._ts = None + self._etag = None class GremlinGraphResource(Model): @@ -1480,7 +1653,7 @@ class MetricDefinition(Model): :vartype metric_availabilities: list[~azure.mgmt.cosmosdb.models.MetricAvailability] :ivar primary_aggregation_type: The primary aggregation type of the - metric. Possible values include: 'None', 'Average', 'Total', 'Minimimum', + metric. Possible values include: 'None', 'Average', 'Total', 'Minimum', 'Maximum', 'Last' :vartype primary_aggregation_type: str or ~azure.mgmt.cosmosdb.models.PrimaryAggregationType @@ -1594,17 +1767,17 @@ def __init__(self, **kwargs) -> None: self.total = None -class MongoDBCollection(Resource): - """An Azure Cosmos DB MongoDB collection. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -1613,21 +1786,20 @@ class MongoDBCollection(Resource): :type location: str :param tags: :type tags: dict[str, str] - :param mongo_db_collection_id: Required. Name of the Cosmos DB MongoDB + :param resource: Required. The standard JSON format of a 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.models.MongoIndex] + :type resource: ~azure.mgmt.cosmosdb.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}, - 'mongo_db_collection_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -1636,45 +1808,85 @@ class MongoDBCollection(Resource): '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]'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, } - 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 + 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 MongoDBCollectionCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB MongoDB collection. +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. - :param resource: Required. The standard JSON format of a MongoDB - collection - :type resource: ~azure.mgmt.cosmosdb.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] + :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.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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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, *, resource, options, **kwargs) -> None: - super(MongoDBCollectionCreateUpdateParameters, self).__init__(**kwargs) - self.resource = resource - self.options = options + 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): @@ -1708,17 +1920,17 @@ def __init__(self, *, id: str, shard_key=None, indexes=None, **kwargs) -> None: self.indexes = indexes -class MongoDBDatabase(Resource): - """An Azure Cosmos DB MongoDB database. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -1727,16 +1939,19 @@ class MongoDBDatabase(Resource): :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 + :param resource: Required. The standard JSON format of a MongoDB database + :type resource: ~azure.mgmt.cosmosdb.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}, - 'mongo_db_database_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -1745,44 +1960,80 @@ class MongoDBDatabase(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'mongo_db_database_id': {'key': 'properties.id', 'type': 'str'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, + 'options': {'key': 'properties.options', '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 + 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. -class MongoDBDatabaseCreateUpdateParameters(Model): - """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. - :param resource: Required. The standard JSON format of a MongoDB database - :type resource: ~azure.mgmt.cosmosdb.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] + :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 = { - 'resource': {'required': True}, - 'options': {'required': True}, + '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 = { - 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + '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, *, resource, options, **kwargs) -> None: - super(MongoDBDatabaseCreateUpdateParameters, self).__init__(**kwargs) - self.resource = resource - self.options = options + 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 id object. + """Cosmos DB MongoDB database resource object. All required parameters must be populated in order to send to Azure. @@ -2212,7 +2463,57 @@ def __init__(self, *, region: str, **kwargs) -> None: self.region = region -class SqlContainer(Resource): +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.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 @@ -2220,9 +2521,9 @@ class SqlContainer(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -2231,8 +2532,9 @@ class SqlContainer(Resource): :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 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 @@ -2250,21 +2552,24 @@ class SqlContainer(Resource): container. :type conflict_resolution_policy: ~azure.mgmt.cosmosdb.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 + :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. - :type _ts: object - :param _etag: A system generated property representing the resource etag + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag required for optimistic concurrency control. - :type _etag: str + :vartype _etag: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'sql_container_id': {'required': True}, + 'sql_container_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, } _attribute_map = { @@ -2273,7 +2578,7 @@ class SqlContainer(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'sql_container_id': {'key': 'properties.id', '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'}, @@ -2284,45 +2589,17 @@ class SqlContainer(Resource): '_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 + 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 = _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.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 + self._rid = None + self._ts = None + self._etag = None class SqlContainerResource(Model): @@ -2374,7 +2651,57 @@ def __init__(self, *, id: str, indexing_policy=None, partition_key=None, default self.conflict_resolution_policy = conflict_resolution_policy -class SqlDatabase(Resource): +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.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 @@ -2382,9 +2709,9 @@ class SqlDatabase(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -2393,16 +2720,17 @@ class SqlDatabase(Resource): :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 + :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. - :type _ts: object - :param _etag: A system generated property representing the resource etag + :vartype _ts: object + :ivar _etag: A system generated property representing the resource etag required for optimistic concurrency control. - :type _etag: str + :vartype _etag: str :param _colls: A system generated property that specified the addressable path of the collections resource. :type _colls: str @@ -2415,7 +2743,10 @@ class SqlDatabase(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'sql_database_id': {'required': True}, + 'sql_database_get_results_id': {'required': True}, + '_rid': {'readonly': True}, + '_ts': {'readonly': True}, + '_etag': {'readonly': True}, } _attribute_map = { @@ -2424,7 +2755,7 @@ class SqlDatabase(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'sql_database_id': {'key': 'properties.id', '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'}, @@ -2432,51 +2763,163 @@ class SqlDatabase(Resource): '_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 + 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 SqlDatabaseCreateUpdateParameters(Model): - """Parameters to create and update Cosmos DB SQL database. +class SqlDatabaseResource(Model): + """Cosmos DB SQL database resource object. 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.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] + :param id: Required. Name of the Cosmos DB SQL database + :type id: str """ _validation = { - 'resource': {'required': True}, - 'options': {'required': True}, + 'id': {'required': True}, } _attribute_map = { - 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, - 'options': {'key': 'properties.options', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, resource, options, **kwargs) -> None: - super(SqlDatabaseCreateUpdateParameters, self).__init__(**kwargs) - self.resource = resource + 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.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 SqlDatabaseResource(Model): - """Cosmos DB SQL database id object. +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. - :param id: Required. Name of the Cosmos DB SQL database + :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 = { @@ -2485,24 +2928,26 @@ class SqlDatabaseResource(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, } - def __init__(self, *, id: str, **kwargs) -> None: - super(SqlDatabaseResource, self).__init__(**kwargs) + def __init__(self, *, id: str, body: str=None, **kwargs) -> None: + super(SqlStoredProcedureResource, self).__init__(**kwargs) self.id = id + self.body = body -class Table(Resource): - """An Azure Cosmos DB Table. +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 database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -2511,15 +2956,19 @@ class Table(Resource): :type location: str :param tags: :type tags: dict[str, str] - :param table_id: Required. Name of the Cosmos DB table - :type table_id: str + :param resource: Required. The standard JSON format of a trigger + :type resource: ~azure.mgmt.cosmosdb.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}, - 'table_id': {'required': True}, + 'resource': {'required': True}, + 'options': {'required': True}, } _attribute_map = { @@ -2528,19 +2977,292 @@ class Table(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'table_id': {'key': 'properties.id', 'type': 'str'}, + 'resource': {'key': 'properties.resource', 'type': 'SqlTriggerResource'}, + 'options': {'key': 'properties.options', '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 + 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.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.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}, + } -class TableCreateUpdateParameters(Model): + _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.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.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.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.models.TableResource :param options: Required. A key-value pair of options to be applied for @@ -2549,23 +3271,92 @@ class TableCreateUpdateParameters(Model): """ _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, **kwargs) -> None: - super(TableCreateUpdateParameters, self).__init__(**kwargs) + 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 id object. + """Cosmos DB table resource object. All required parameters must be populated in order to send to Azure. @@ -2586,7 +3377,7 @@ def __init__(self, *, id: str, **kwargs) -> None: self.id = id -class Throughput(Resource): +class ThroughputSettingsGetResults(ARMResourceProperties): """An Azure Cosmos DB resource throughput. Variables are only populated by the server, and will be ignored when @@ -2594,9 +3385,9 @@ class Throughput(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str @@ -2607,6 +3398,10 @@ class Throughput(Resource): :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 = { @@ -2614,6 +3409,8 @@ class Throughput(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'throughput': {'required': True}, + 'minimum_throughput': {'readonly': True}, + 'offer_replace_pending': {'readonly': True}, } _attribute_map = { @@ -2623,55 +3420,94 @@ class Throughput(Resource): '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(Throughput, self).__init__(location=location, tags=tags, **kwargs) + super(ThroughputSettingsGetResults, self).__init__(location=location, tags=tags, **kwargs) self.throughput = throughput + self.minimum_throughput = None + self.offer_replace_pending = None -class ThroughputResource(Model): +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(ThroughputResource, self).__init__(**kwargs) + super(ThroughputSettingsResource, self).__init__(**kwargs) self.throughput = throughput + self.minimum_throughput = None + self.offer_replace_pending = None -class ThroughputUpdateParameters(Model): +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.models.ThroughputResource + :type resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource """ _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'resource': {'required': True}, } _attribute_map = { - 'resource': {'key': 'properties.resource', 'type': 'ThroughputResource'}, + '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, **kwargs) -> None: - super(ThroughputUpdateParameters, self).__init__(**kwargs) + def __init__(self, *, resource, location: str=None, tags=None, **kwargs) -> None: + super(ThroughputSettingsUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_paged_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_paged_models.py index 4f822e53855b..9c0286b4857b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_paged_models.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_paged_models.py @@ -12,19 +12,19 @@ from msrest.paging import Paged -class DatabaseAccountPaged(Paged): +class DatabaseAccountGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`DatabaseAccount ` object + 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': '[DatabaseAccount]'} + 'current_page': {'key': 'value', 'type': '[DatabaseAccountGetResults]'} } def __init__(self, *args, **kwargs): - super(DatabaseAccountPaged, self).__init__(*args, **kwargs) + super(DatabaseAccountGetResultsPaged, self).__init__(*args, **kwargs) class MetricPaged(Paged): """ A paging container for iterating over a list of :class:`Metric ` object @@ -64,172 +64,211 @@ class MetricDefinitionPaged(Paged): def __init__(self, *args, **kwargs): super(MetricDefinitionPaged, self).__init__(*args, **kwargs) -class SqlDatabasePaged(Paged): +class OperationPaged(Paged): """ - A paging container for iterating over a list of :class:`SqlDatabase ` object + 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': '[SqlDatabase]'} + 'current_page': {'key': 'value', 'type': '[Operation]'} } def __init__(self, *args, **kwargs): - super(SqlDatabasePaged, self).__init__(*args, **kwargs) -class SqlContainerPaged(Paged): + super(OperationPaged, self).__init__(*args, **kwargs) +class PercentileMetricPaged(Paged): """ - A paging container for iterating over a list of :class:`SqlContainer ` object + 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': '[SqlContainer]'} + 'current_page': {'key': 'value', 'type': '[PercentileMetric]'} } def __init__(self, *args, **kwargs): - super(SqlContainerPaged, self).__init__(*args, **kwargs) -class MongoDBDatabasePaged(Paged): + super(PercentileMetricPaged, self).__init__(*args, **kwargs) +class PartitionMetricPaged(Paged): """ - A paging container for iterating over a list of :class:`MongoDBDatabase ` object + 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': '[MongoDBDatabase]'} + 'current_page': {'key': 'value', 'type': '[PartitionMetric]'} } def __init__(self, *args, **kwargs): - super(MongoDBDatabasePaged, self).__init__(*args, **kwargs) -class MongoDBCollectionPaged(Paged): + super(PartitionMetricPaged, self).__init__(*args, **kwargs) +class PartitionUsagePaged(Paged): """ - A paging container for iterating over a list of :class:`MongoDBCollection ` object + 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': '[MongoDBCollection]'} + 'current_page': {'key': 'value', 'type': '[PartitionUsage]'} } def __init__(self, *args, **kwargs): - super(MongoDBCollectionPaged, self).__init__(*args, **kwargs) -class TablePaged(Paged): + super(PartitionUsagePaged, self).__init__(*args, **kwargs) +class SqlDatabaseGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`Table ` object + 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': '[Table]'} + 'current_page': {'key': 'value', 'type': '[SqlDatabaseGetResults]'} } def __init__(self, *args, **kwargs): - super(TablePaged, self).__init__(*args, **kwargs) -class CassandraKeyspacePaged(Paged): + super(SqlDatabaseGetResultsPaged, self).__init__(*args, **kwargs) +class SqlContainerGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`CassandraKeyspace ` object + 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': '[CassandraKeyspace]'} + 'current_page': {'key': 'value', 'type': '[SqlContainerGetResults]'} } def __init__(self, *args, **kwargs): - super(CassandraKeyspacePaged, self).__init__(*args, **kwargs) -class CassandraTablePaged(Paged): + super(SqlContainerGetResultsPaged, self).__init__(*args, **kwargs) +class SqlStoredProcedureGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`CassandraTable ` object + 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': '[CassandraTable]'} + 'current_page': {'key': 'value', 'type': '[SqlStoredProcedureGetResults]'} } def __init__(self, *args, **kwargs): - super(CassandraTablePaged, self).__init__(*args, **kwargs) -class GremlinDatabasePaged(Paged): + super(SqlStoredProcedureGetResultsPaged, self).__init__(*args, **kwargs) +class SqlUserDefinedFunctionGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`GremlinDatabase ` object + 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': '[GremlinDatabase]'} + 'current_page': {'key': 'value', 'type': '[SqlUserDefinedFunctionGetResults]'} } def __init__(self, *args, **kwargs): - super(GremlinDatabasePaged, self).__init__(*args, **kwargs) -class GremlinGraphPaged(Paged): + super(SqlUserDefinedFunctionGetResultsPaged, self).__init__(*args, **kwargs) +class SqlTriggerGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`GremlinGraph ` object + 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': '[GremlinGraph]'} + 'current_page': {'key': 'value', 'type': '[SqlTriggerGetResults]'} } def __init__(self, *args, **kwargs): - super(GremlinGraphPaged, self).__init__(*args, **kwargs) -class OperationPaged(Paged): + super(SqlTriggerGetResultsPaged, self).__init__(*args, **kwargs) +class MongoDBDatabaseGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`Operation ` object + 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': '[Operation]'} + 'current_page': {'key': 'value', 'type': '[MongoDBDatabaseGetResults]'} } def __init__(self, *args, **kwargs): - super(OperationPaged, self).__init__(*args, **kwargs) -class PercentileMetricPaged(Paged): + super(MongoDBDatabaseGetResultsPaged, self).__init__(*args, **kwargs) +class MongoDBCollectionGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`PercentileMetric ` object + 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': '[PercentileMetric]'} + 'current_page': {'key': 'value', 'type': '[MongoDBCollectionGetResults]'} } def __init__(self, *args, **kwargs): - super(PercentileMetricPaged, self).__init__(*args, **kwargs) -class PartitionMetricPaged(Paged): + super(MongoDBCollectionGetResultsPaged, self).__init__(*args, **kwargs) +class TableGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`PartitionMetric ` object + 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': '[PartitionMetric]'} + 'current_page': {'key': 'value', 'type': '[TableGetResults]'} } def __init__(self, *args, **kwargs): - super(PartitionMetricPaged, self).__init__(*args, **kwargs) -class PartitionUsagePaged(Paged): + super(TableGetResultsPaged, self).__init__(*args, **kwargs) +class CassandraKeyspaceGetResultsPaged(Paged): """ - A paging container for iterating over a list of :class:`PartitionUsage ` object + 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': '[PartitionUsage]'} + 'current_page': {'key': 'value', 'type': '[CassandraKeyspaceGetResults]'} } def __init__(self, *args, **kwargs): - super(PartitionUsagePaged, self).__init__(*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/operations/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py index 5b015813966f..82963bb5681e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py @@ -22,6 +22,11 @@ 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', @@ -37,4 +42,9 @@ 'CollectionPartitionOperations', 'PartitionKeyRangeIdOperations', 'PartitionKeyRangeIdRegionOperations', + 'SqlResourcesOperations', + 'MongoDBResourcesOperations', + 'TableResourcesOperations', + 'CassandraResourcesOperations', + 'GremlinResourcesOperations', ] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_resources_operations.py new file mode 100644 index 000000000000..1c1b20290d1a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_resources_operations.py @@ -0,0 +1,1063 @@ +# 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.models.CassandraKeyspaceGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.CassandraKeyspaceGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.CassandraTableGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.CassandraTableGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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/operations/_collection_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_operations.py index 0ce710ceed2c..6625da8ca5c0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_operations.py @@ -25,7 +25,7 @@ class CollectionOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_operations.py index 7348d68a0737..9abb55d22edc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_operations.py @@ -25,7 +25,7 @@ class CollectionPartitionOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_region_operations.py index f4451ad00060..e5e4e613fbce 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_region_operations.py @@ -25,7 +25,7 @@ class CollectionPartitionRegionOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_region_operations.py index 16d0130581c3..4efa93d1f031 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_region_operations.py @@ -25,7 +25,7 @@ class CollectionRegionOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_account_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_account_region_operations.py index 882503b0bca2..e6936977e156 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_account_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_account_region_operations.py @@ -25,7 +25,7 @@ class DatabaseAccountRegionOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_accounts_operations.py index 6e831db4ba66..5c69e7f9298b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_accounts_operations.py @@ -27,7 +27,7 @@ class DatabaseAccountsOperations(object): :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". + :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 @@ -37,7 +37,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config @@ -55,8 +55,8 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: DatabaseAccount or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccount or + :return: DatabaseAccountGetResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -94,7 +94,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('DatabaseAccount', response) + deserialized = self._deserialize('DatabaseAccountGetResults', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -147,7 +147,7 @@ def _patch_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('DatabaseAccount', response) + deserialized = self._deserialize('DatabaseAccountGetResults', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -172,12 +172,13 @@ def patch( 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 + :return: An instance of LROPoller that returns + DatabaseAccountGetResults or + ClientRawResponse if raw==True :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.DatabaseAccount] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.DatabaseAccount]] + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]] :raises: :class:`CloudError` """ raw_result = self._patch_initial( @@ -191,7 +192,7 @@ def patch( ) def get_long_running_output(response): - deserialized = self._deserialize('DatabaseAccount', response) + deserialized = self._deserialize('DatabaseAccountGetResults', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -250,7 +251,7 @@ def _create_or_update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('DatabaseAccount', response) + deserialized = self._deserialize('DatabaseAccountGetResults', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -275,12 +276,13 @@ def create_or_update( 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 + :return: An instance of LROPoller that returns + DatabaseAccountGetResults or + ClientRawResponse if raw==True :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.DatabaseAccount] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.DatabaseAccount]] + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]] :raises: :class:`CloudError` """ raw_result = self._create_or_update_initial( @@ -293,7 +295,7 @@ def create_or_update( ) def get_long_running_output(response): - deserialized = self._deserialize('DatabaseAccount', response) + deserialized = self._deserialize('DatabaseAccountGetResults', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -492,9 +494,9 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of DatabaseAccount + :return: An iterator like instance of DatabaseAccountGetResults :rtype: - ~azure.mgmt.cosmosdb.models.DatabaseAccountPaged[~azure.mgmt.cosmosdb.models.DatabaseAccount] + ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResultsPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] :raises: :class:`CloudError` """ def prepare_request(next_link=None): @@ -544,7 +546,7 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.DatabaseAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) + deserialized = models.DatabaseAccountGetResultsPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts'} @@ -561,9 +563,9 @@ def list_by_resource_group( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of DatabaseAccount + :return: An iterator like instance of DatabaseAccountGetResults :rtype: - ~azure.mgmt.cosmosdb.models.DatabaseAccountPaged[~azure.mgmt.cosmosdb.models.DatabaseAccount] + ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResultsPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] :raises: :class:`CloudError` """ def prepare_request(next_link=None): @@ -614,7 +616,7 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.DatabaseAccountPaged(internal_paging, self._deserialize.dependencies, 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'} @@ -1424,4604 +1426,3 @@ def internal_paging(next_link=None): 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.models.SqlDatabasePaged[~azure.mgmt.cosmosdb.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.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.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.models.SqlDatabase] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.Throughput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.SqlContainerPaged[~azure.mgmt.cosmosdb.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.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.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.models.SqlContainer] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.Throughput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.MongoDBDatabasePaged[~azure.mgmt.cosmosdb.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.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.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.models.MongoDBDatabase] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.Throughput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.MongoDBCollectionPaged[~azure.mgmt.cosmosdb.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.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.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.models.MongoDBCollection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.Throughput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.TablePaged[~azure.mgmt.cosmosdb.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.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.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.models.Table] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.Throughput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.CassandraKeyspacePaged[~azure.mgmt.cosmosdb.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.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.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.models.CassandraKeyspace] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.Throughput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.CassandraTablePaged[~azure.mgmt.cosmosdb.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.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.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.models.CassandraTable] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.Throughput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.GremlinDatabasePaged[~azure.mgmt.cosmosdb.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.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.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.models.GremlinDatabase] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.Throughput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.GremlinGraphPaged[~azure.mgmt.cosmosdb.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.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.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.models.GremlinGraph] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.Throughput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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/operations/_database_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_operations.py index 226048cb6f1c..99924fa25e9c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_operations.py @@ -25,7 +25,7 @@ class DatabaseOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_gremlin_resources_operations.py new file mode 100644 index 000000000000..a2de0aa16135 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_gremlin_resources_operations.py @@ -0,0 +1,1062 @@ +# 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.models.GremlinDatabaseGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.GremlinDatabaseGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.GremlinGraphGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.GremlinGraphGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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/operations/_mongo_db_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_mongo_db_resources_operations.py new file mode 100644 index 000000000000..b3a5a85ce810 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_mongo_db_resources_operations.py @@ -0,0 +1,1063 @@ +# 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.models.MongoDBDatabaseGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.MongoDBDatabaseGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.MongoDBCollectionGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.MongoDBCollectionGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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/operations/_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_operations.py index fc8994661650..99522b8106ec 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_operations.py @@ -25,7 +25,7 @@ class Operations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_operations.py index 657f9b252730..3b40c73a7331 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_operations.py @@ -25,7 +25,7 @@ class PartitionKeyRangeIdOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_region_operations.py index e79d4faa16fb..e8845d4361a5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_region_operations.py @@ -25,7 +25,7 @@ class PartitionKeyRangeIdRegionOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_operations.py index f091bfcb9b9e..6060f545eaed 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_operations.py @@ -25,7 +25,7 @@ class PercentileOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_source_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_source_target_operations.py index abc142c32f5f..5e4f6f3135fc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_source_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_source_target_operations.py @@ -25,7 +25,7 @@ class PercentileSourceTargetOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_target_operations.py index 5717ef99c4ad..5bb6c3a69845 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_target_operations.py @@ -25,7 +25,7 @@ class PercentileTargetOperations(object): :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". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-08" + self.api_version = "2019-08-01" self.config = config diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_sql_resources_operations.py new file mode 100644 index 000000000000..55120ab74132 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_sql_resources_operations.py @@ -0,0 +1,2129 @@ +# 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.models.SqlDatabaseGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.SqlDatabaseGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.SqlContainerGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.SqlContainerGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.SqlStoredProcedureGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.SqlStoredProcedureGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.SqlUserDefinedFunctionGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.SqlUserDefinedFunctionGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.models.SqlTriggerGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.SqlTriggerGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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/operations/_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_table_resources_operations.py new file mode 100644 index 000000000000..de9502cf86aa --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_table_resources_operations.py @@ -0,0 +1,540 @@ +# 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.models.TableGetResultsPaged[~azure.mgmt.cosmosdb.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.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.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.models.TableGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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.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.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.models.ThroughputSettingsGetResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.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'}