From af6f052d4b4db562dfcbde79870a7a032d587426 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 23 Feb 2021 07:00:08 +0000 Subject: [PATCH] CodeGen from PR 13104 in Azure/azure-rest-api-specs Merge d98f3bfb2d92fda759fb65b9c248f38cf1059007 into 62572501bc13ded1e17d61c7d08220990f39c6ac --- .../azure/mgmt/cosmosdb/_configuration.py | 1 + .../cosmosdb/_cosmos_db_management_client.py | 1 - .../azure/mgmt/cosmosdb/_metadata.json | 81 +++ .../azure/mgmt/cosmosdb/_version.py | 2 +- .../azure/mgmt/cosmosdb/aio/_configuration.py | 1 + .../aio/_cosmos_db_management_client.py | 1 - .../_cassandra_resources_operations.py | 247 ++++--- .../aio/operations/_collection_operations.py | 22 +- .../_collection_partition_operations.py | 16 +- ..._collection_partition_region_operations.py | 10 +- .../_collection_region_operations.py | 10 +- .../_database_account_region_operations.py | 10 +- .../_database_accounts_operations.py | 180 +++-- .../aio/operations/_database_operations.py | 22 +- .../_gremlin_resources_operations.py | 247 ++++--- .../_mongo_db_resources_operations.py | 250 ++++--- .../_notebook_workspaces_operations.py | 112 ++-- .../cosmosdb/aio/operations/_operations.py | 10 +- .../_partition_key_range_id_operations.py | 10 +- ...artition_key_range_id_region_operations.py | 10 +- .../aio/operations/_percentile_operations.py | 10 +- .../_percentile_source_target_operations.py | 10 +- .../_percentile_target_operations.py | 10 +- ...private_endpoint_connections_operations.py | 72 +- .../_private_link_resources_operations.py | 16 +- .../operations/_sql_resources_operations.py | 400 +++++++---- .../operations/_table_resources_operations.py | 123 ++-- .../azure/mgmt/cosmosdb/models/__init__.py | 39 +- .../_cosmos_db_management_client_enums.py | 40 +- .../azure/mgmt/cosmosdb/models/_models.py | 594 ++++++++++++----- .../azure/mgmt/cosmosdb/models/_models_py3.py | 625 +++++++++++++----- .../_cassandra_resources_operations.py | 247 ++++--- .../operations/_collection_operations.py | 22 +- .../_collection_partition_operations.py | 16 +- ..._collection_partition_region_operations.py | 10 +- .../_collection_region_operations.py | 10 +- .../_database_account_region_operations.py | 10 +- .../_database_accounts_operations.py | 180 +++-- .../operations/_database_operations.py | 22 +- .../_gremlin_resources_operations.py | 247 ++++--- .../_mongo_db_resources_operations.py | 250 ++++--- .../_notebook_workspaces_operations.py | 112 ++-- .../mgmt/cosmosdb/operations/_operations.py | 10 +- .../_partition_key_range_id_operations.py | 10 +- ...artition_key_range_id_region_operations.py | 10 +- .../operations/_percentile_operations.py | 10 +- .../_percentile_source_target_operations.py | 10 +- .../_percentile_target_operations.py | 10 +- ...private_endpoint_connections_operations.py | 72 +- .../_private_link_resources_operations.py | 16 +- .../operations/_sql_resources_operations.py | 400 +++++++---- .../operations/_table_resources_operations.py | 123 ++-- 52 files changed, 3325 insertions(+), 1654 deletions(-) create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_metadata.json diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py index f001034a2727..a3d67b7cadae 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py @@ -48,6 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.api_version = "2021-01-15" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-cosmosdb/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py index 23596a5fe159..cb4f3acb30b0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py @@ -110,7 +110,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.database_accounts = DatabaseAccountsOperations( diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_metadata.json b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_metadata.json new file mode 100644 index 000000000000..78fb2f4bb20e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_metadata.json @@ -0,0 +1,81 @@ +{ + "chosen_version": "2021-01-15", + "total_api_version_list": ["2021-01-15"], + "client": { + "name": "CosmosDBManagementClient", + "filename": "_cosmos_db_management_client", + "description": "Azure Cosmos DB Database Service Resource Provider REST API.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": true + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "database_accounts": "DatabaseAccountsOperations", + "operations": "Operations", + "database": "DatabaseOperations", + "collection": "CollectionOperations", + "collection_region": "CollectionRegionOperations", + "database_account_region": "DatabaseAccountRegionOperations", + "percentile_source_target": "PercentileSourceTargetOperations", + "percentile_target": "PercentileTargetOperations", + "percentile": "PercentileOperations", + "collection_partition_region": "CollectionPartitionRegionOperations", + "collection_partition": "CollectionPartitionOperations", + "partition_key_range_id": "PartitionKeyRangeIdOperations", + "partition_key_range_id_region": "PartitionKeyRangeIdRegionOperations", + "sql_resources": "SqlResourcesOperations", + "mongo_db_resources": "MongoDBResourcesOperations", + "table_resources": "TableResourcesOperations", + "cassandra_resources": "CassandraResourcesOperations", + "gremlin_resources": "GremlinResourcesOperations", + "notebook_workspaces": "NotebookWorkspacesOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_version.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_version.py index caf312bd2d0b..a712687790e5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_version.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.0.0" +VERSION = "0.7.0" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_configuration.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_configuration.py index d414afddc61f..3782a9fcf113 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_configuration.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_configuration.py @@ -45,6 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.api_version = "2021-01-15" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-cosmosdb/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_cosmos_db_management_client.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_cosmos_db_management_client.py index 45e1b1c89d65..36ec319f7354 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_cosmos_db_management_client.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_cosmos_db_management_client.py @@ -107,7 +107,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.database_accounts = DatabaseAccountsOperations( diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_resources_operations.py index 46a89105fa77..bd12672754d9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class CassandraResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_cassandra_keyspaces( resource_group_name: str, account_name: str, **kwargs - ) -> AsyncIterable["models.CassandraKeyspaceListResult"]: + ) -> AsyncIterable["_models.CassandraKeyspaceListResult"]: """Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,12 +60,12 @@ def list_cassandra_keyspaces( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraKeyspaceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraKeyspaceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -123,7 +123,7 @@ async def get_cassandra_keyspace( account_name: str, keyspace_name: str, **kwargs - ) -> "models.CassandraKeyspaceGetResults": + ) -> "_models.CassandraKeyspaceGetResults": """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. @@ -138,12 +138,12 @@ async def get_cassandra_keyspace( :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraKeyspaceGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraKeyspaceGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -185,15 +185,15 @@ async def _create_update_cassandra_keyspace_initial( resource_group_name: str, account_name: str, keyspace_name: str, - create_update_cassandra_keyspace_parameters: "models.CassandraKeyspaceCreateUpdateParameters", + create_update_cassandra_keyspace_parameters: "_models.CassandraKeyspaceCreateUpdateParameters", **kwargs - ) -> Optional["models.CassandraKeyspaceGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.CassandraKeyspaceGetResults"]] + ) -> Optional["_models.CassandraKeyspaceGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CassandraKeyspaceGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -242,9 +242,9 @@ async def begin_create_update_cassandra_keyspace( resource_group_name: str, account_name: str, keyspace_name: str, - create_update_cassandra_keyspace_parameters: "models.CassandraKeyspaceCreateUpdateParameters", + create_update_cassandra_keyspace_parameters: "_models.CassandraKeyspaceCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.CassandraKeyspaceGetResults"]: + ) -> AsyncLROPoller["_models.CassandraKeyspaceGetResults"]: """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -267,7 +267,7 @@ async def begin_create_update_cassandra_keyspace( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraKeyspaceGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraKeyspaceGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -293,7 +293,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -319,7 +326,7 @@ async def _delete_cassandra_keyspace_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_cassandra_keyspace_initial.metadata['url'] # type: ignore @@ -399,7 +406,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -419,7 +433,7 @@ async def get_cassandra_keyspace_throughput( account_name: str, keyspace_name: str, **kwargs - ) -> "models.ThroughputSettingsGetResults": + ) -> "_models.ThroughputSettingsGetResults": """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. @@ -434,12 +448,12 @@ async def get_cassandra_keyspace_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -481,15 +495,15 @@ async def _update_cassandra_keyspace_throughput_initial( resource_group_name: str, account_name: str, keyspace_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -538,9 +552,9 @@ async def begin_update_cassandra_keyspace_throughput( resource_group_name: str, account_name: str, keyspace_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -563,7 +577,7 @@ async def begin_update_cassandra_keyspace_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -589,7 +603,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -609,13 +630,13 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( account_name: str, keyspace_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -642,7 +663,8 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -660,7 +682,7 @@ async def begin_migrate_cassandra_keyspace_to_autoscale( account_name: str, keyspace_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -680,7 +702,7 @@ async def begin_migrate_cassandra_keyspace_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -705,7 +727,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -725,13 +754,13 @@ async def _migrate_cassandra_keyspace_to_manual_throughput_initial( account_name: str, keyspace_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -758,7 +787,8 @@ async def _migrate_cassandra_keyspace_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -776,7 +806,7 @@ async def begin_migrate_cassandra_keyspace_to_manual_throughput( account_name: str, keyspace_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -796,7 +826,7 @@ async def begin_migrate_cassandra_keyspace_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -821,7 +851,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -841,7 +878,7 @@ def list_cassandra_tables( account_name: str, keyspace_name: str, **kwargs - ) -> AsyncIterable["models.CassandraTableListResult"]: + ) -> AsyncIterable["_models.CassandraTableListResult"]: """Lists the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -855,12 +892,12 @@ def list_cassandra_tables( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraTableListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraTableListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -920,7 +957,7 @@ async def get_cassandra_table( keyspace_name: str, table_name: str, **kwargs - ) -> "models.CassandraTableGetResults": + ) -> "_models.CassandraTableGetResults": """Gets the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -936,12 +973,12 @@ async def get_cassandra_table( :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraTableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraTableGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -985,15 +1022,15 @@ async def _create_update_cassandra_table_initial( account_name: str, keyspace_name: str, table_name: str, - create_update_cassandra_table_parameters: "models.CassandraTableCreateUpdateParameters", + create_update_cassandra_table_parameters: "_models.CassandraTableCreateUpdateParameters", **kwargs - ) -> Optional["models.CassandraTableGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.CassandraTableGetResults"]] + ) -> Optional["_models.CassandraTableGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CassandraTableGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1044,9 +1081,9 @@ async def begin_create_update_cassandra_table( account_name: str, keyspace_name: str, table_name: str, - create_update_cassandra_table_parameters: "models.CassandraTableCreateUpdateParameters", + create_update_cassandra_table_parameters: "_models.CassandraTableCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.CassandraTableGetResults"]: + ) -> AsyncLROPoller["_models.CassandraTableGetResults"]: """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1071,7 +1108,7 @@ async def begin_create_update_cassandra_table( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraTableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraTableGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1098,7 +1135,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1125,7 +1170,7 @@ async def _delete_cassandra_table_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_cassandra_table_initial.metadata['url'] # type: ignore @@ -1210,7 +1255,15 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1231,7 +1284,7 @@ async def get_cassandra_table_throughput( keyspace_name: str, table_name: str, **kwargs - ) -> "models.ThroughputSettingsGetResults": + ) -> "_models.ThroughputSettingsGetResults": """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. @@ -1248,12 +1301,12 @@ async def get_cassandra_table_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1297,15 +1350,15 @@ async def _update_cassandra_table_throughput_initial( account_name: str, keyspace_name: str, table_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1356,9 +1409,9 @@ async def begin_update_cassandra_table_throughput( account_name: str, keyspace_name: str, table_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1383,7 +1436,7 @@ async def begin_update_cassandra_table_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1410,7 +1463,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1431,13 +1492,13 @@ async def _migrate_cassandra_table_to_autoscale_initial( keyspace_name: str, table_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1465,7 +1526,8 @@ async def _migrate_cassandra_table_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1484,7 +1546,7 @@ async def begin_migrate_cassandra_table_to_autoscale( keyspace_name: str, table_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1506,7 +1568,7 @@ async def begin_migrate_cassandra_table_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1532,7 +1594,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1553,13 +1623,13 @@ async def _migrate_cassandra_table_to_manual_throughput_initial( keyspace_name: str, table_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1587,7 +1657,8 @@ async def _migrate_cassandra_table_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1606,7 +1677,7 @@ async def begin_migrate_cassandra_table_to_manual_throughput( keyspace_name: str, table_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1628,7 +1699,7 @@ async def begin_migrate_cassandra_table_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1654,7 +1725,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_operations.py index 83569381ce02..d13651247fd9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class CollectionOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,7 +49,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs - ) -> AsyncIterable["models.MetricListResult"]: + ) -> AsyncIterable["_models.MetricListResult"]: """Retrieves the metrics determined by the given filter for the given database account and collection. @@ -70,12 +70,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -138,7 +138,7 @@ def list_usages( collection_rid: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.UsagesResult"]: + ) -> AsyncIterable["_models.UsagesResult"]: """Retrieves the usages (most recent storage data) for the given collection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -157,12 +157,12 @@ def list_usages( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.UsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -225,7 +225,7 @@ def list_metric_definitions( database_rid: str, collection_rid: str, **kwargs - ) -> AsyncIterable["models.MetricDefinitionsListResult"]: + ) -> AsyncIterable["_models.MetricDefinitionsListResult"]: """Retrieves metric definitions for the given collection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -241,12 +241,12 @@ def list_metric_definitions( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_operations.py index 9d0511f38853..edb2a09631b7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class CollectionPartitionOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,7 +49,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs - ) -> AsyncIterable["models.PartitionMetricListResult"]: + ) -> AsyncIterable["_models.PartitionMetricListResult"]: """Retrieves the metrics determined by the given filter for the given collection, split by partition. @@ -70,12 +70,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -138,7 +138,7 @@ def list_usages( collection_rid: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PartitionUsagesResult"]: + ) -> AsyncIterable["_models.PartitionUsagesResult"]: """Retrieves the usages (most recent storage data) for the given collection, split by partition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -157,12 +157,12 @@ def list_usages( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionUsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_region_operations.py index 06a8aec4976d..732761a94b7c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_region_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class CollectionPartitionRegionOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs - ) -> AsyncIterable["models.PartitionMetricListResult"]: + ) -> AsyncIterable["_models.PartitionMetricListResult"]: """Retrieves the metrics determined by the given filter for the given collection and region, split by partition. @@ -73,12 +73,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_region_operations.py index 68c4b2d3d275..dc8f5b2112ca 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_region_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class CollectionRegionOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs - ) -> AsyncIterable["models.MetricListResult"]: + ) -> AsyncIterable["_models.MetricListResult"]: """Retrieves the metrics determined by the given filter for the given database account, collection and region. @@ -73,12 +73,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_account_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_account_region_operations.py index e85029ba8f18..e5d381f8aa7c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_account_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_account_region_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DatabaseAccountRegionOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_metrics( region: str, filter: str, **kwargs - ) -> AsyncIterable["models.MetricListResult"]: + ) -> AsyncIterable["_models.MetricListResult"]: """Retrieves the metrics determined by the given filter for the given database account and region. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,12 +66,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_accounts_operations.py index 168f329a83a3..206e300fd3b3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_accounts_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DatabaseAccountsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( resource_group_name: str, account_name: str, **kwargs - ) -> "models.DatabaseAccountGetResults": + ) -> "_models.DatabaseAccountGetResults": """Retrieves the properties of an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,12 +60,12 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -105,15 +105,15 @@ async def _update_initial( self, resource_group_name: str, account_name: str, - update_parameters: "models.DatabaseAccountUpdateParameters", + update_parameters: "_models.DatabaseAccountUpdateParameters", **kwargs - ) -> "models.DatabaseAccountGetResults": - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + ) -> "_models.DatabaseAccountGetResults": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -158,9 +158,9 @@ async def begin_update( self, resource_group_name: str, account_name: str, - update_parameters: "models.DatabaseAccountUpdateParameters", + update_parameters: "_models.DatabaseAccountUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.DatabaseAccountGetResults"]: + ) -> AsyncLROPoller["_models.DatabaseAccountGetResults"]: """Updates the properties of an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -180,7 +180,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -205,7 +205,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -223,15 +229,15 @@ async def _create_or_update_initial( self, resource_group_name: str, account_name: str, - create_update_parameters: "models.DatabaseAccountCreateUpdateParameters", + create_update_parameters: "_models.DatabaseAccountCreateUpdateParameters", **kwargs - ) -> "models.DatabaseAccountGetResults": - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + ) -> "_models.DatabaseAccountGetResults": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -276,9 +282,9 @@ async def begin_create_or_update( self, resource_group_name: str, account_name: str, - create_update_parameters: "models.DatabaseAccountCreateUpdateParameters", + create_update_parameters: "_models.DatabaseAccountCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.DatabaseAccountGetResults"]: + ) -> AsyncLROPoller["_models.DatabaseAccountGetResults"]: """Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. @@ -299,7 +305,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -324,7 +330,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -349,7 +361,7 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -424,7 +436,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -442,7 +460,7 @@ async def _failover_priority_change_initial( self, resource_group_name: str, account_name: str, - failover_parameters: "models.FailoverPolicies", + failover_parameters: "_models.FailoverPolicies", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -450,7 +468,7 @@ async def _failover_priority_change_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") # Construct URL @@ -490,7 +508,7 @@ async def begin_failover_priority_change( self, resource_group_name: str, account_name: str, - failover_parameters: "models.FailoverPolicies", + failover_parameters: "_models.FailoverPolicies", **kwargs ) -> AsyncLROPoller[None]: """Changes the failover priority for the Azure Cosmos DB database account. A failover priority of @@ -537,7 +555,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -554,7 +578,7 @@ def get_long_running_output(pipeline_response): def list( self, **kwargs - ) -> AsyncIterable["models.DatabaseAccountsListResult"]: + ) -> AsyncIterable["_models.DatabaseAccountsListResult"]: """Lists all the Azure Cosmos DB database accounts available under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -562,12 +586,12 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -621,7 +645,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.DatabaseAccountsListResult"]: + ) -> AsyncIterable["_models.DatabaseAccountsListResult"]: """Lists all the Azure Cosmos DB database accounts available under the given resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -631,12 +655,12 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -692,7 +716,7 @@ async def list_keys( resource_group_name: str, account_name: str, **kwargs - ) -> "models.DatabaseAccountListKeysResult": + ) -> "_models.DatabaseAccountListKeysResult": """Lists the access keys for the specified Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -704,12 +728,12 @@ async def list_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountListKeysResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -750,7 +774,7 @@ async def list_connection_strings( resource_group_name: str, account_name: str, **kwargs - ) -> "models.DatabaseAccountListConnectionStringsResult": + ) -> "_models.DatabaseAccountListConnectionStringsResult": """Lists the connection strings for the specified Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -762,12 +786,12 @@ async def list_connection_strings( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListConnectionStringsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountListConnectionStringsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListConnectionStringsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -807,7 +831,7 @@ async def _offline_region_initial( self, resource_group_name: str, account_name: str, - region_parameter_for_offline: "models.RegionForOnlineOffline", + region_parameter_for_offline: "_models.RegionForOnlineOffline", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -815,7 +839,7 @@ async def _offline_region_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -846,7 +870,7 @@ async def _offline_region_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -858,7 +882,7 @@ async def begin_offline_region( self, resource_group_name: str, account_name: str, - region_parameter_for_offline: "models.RegionForOnlineOffline", + region_parameter_for_offline: "_models.RegionForOnlineOffline", **kwargs ) -> AsyncLROPoller[None]: """Offline the specified region for the specified Azure Cosmos DB database account. @@ -902,7 +926,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -920,7 +950,7 @@ async def _online_region_initial( self, resource_group_name: str, account_name: str, - region_parameter_for_online: "models.RegionForOnlineOffline", + region_parameter_for_online: "_models.RegionForOnlineOffline", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -928,7 +958,7 @@ async def _online_region_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -959,7 +989,7 @@ async def _online_region_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -971,7 +1001,7 @@ async def begin_online_region( self, resource_group_name: str, account_name: str, - region_parameter_for_online: "models.RegionForOnlineOffline", + region_parameter_for_online: "_models.RegionForOnlineOffline", **kwargs ) -> AsyncLROPoller[None]: """Online the specified region for the specified Azure Cosmos DB database account. @@ -1015,7 +1045,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1034,7 +1070,7 @@ async def get_read_only_keys( resource_group_name: str, account_name: str, **kwargs - ) -> "models.DatabaseAccountListReadOnlyKeysResult": + ) -> "_models.DatabaseAccountListReadOnlyKeysResult": """Lists the read-only access keys for the specified Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1046,12 +1082,12 @@ async def get_read_only_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountListReadOnlyKeysResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListReadOnlyKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1092,7 +1128,7 @@ async def list_read_only_keys( resource_group_name: str, account_name: str, **kwargs - ) -> "models.DatabaseAccountListReadOnlyKeysResult": + ) -> "_models.DatabaseAccountListReadOnlyKeysResult": """Lists the read-only access keys for the specified Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1104,12 +1140,12 @@ async def list_read_only_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountListReadOnlyKeysResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListReadOnlyKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1149,7 +1185,7 @@ async def _regenerate_key_initial( self, resource_group_name: str, account_name: str, - key_to_regenerate: "models.DatabaseAccountRegenerateKeyParameters", + key_to_regenerate: "_models.DatabaseAccountRegenerateKeyParameters", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -1157,7 +1193,7 @@ async def _regenerate_key_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") # Construct URL @@ -1197,7 +1233,7 @@ async def begin_regenerate_key( self, resource_group_name: str, account_name: str, - key_to_regenerate: "models.DatabaseAccountRegenerateKeyParameters", + key_to_regenerate: "_models.DatabaseAccountRegenerateKeyParameters", **kwargs ) -> AsyncLROPoller[None]: """Regenerates an access key for the specified Azure Cosmos DB database account. @@ -1241,7 +1277,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1276,7 +1318,7 @@ async def check_name_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self.check_name_exists.metadata['url'] # type: ignore @@ -1312,7 +1354,7 @@ def list_metrics( account_name: str, filter: str, **kwargs - ) -> AsyncIterable["models.MetricListResult"]: + ) -> AsyncIterable["_models.MetricListResult"]: """Retrieves the metrics determined by the given filter for the given database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1328,12 +1370,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -1392,7 +1434,7 @@ def list_usages( account_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.UsagesResult"]: + ) -> AsyncIterable["_models.UsagesResult"]: """Retrieves the usages (most recent data) for the given database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1407,12 +1449,12 @@ def list_usages( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.UsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -1471,7 +1513,7 @@ def list_metric_definitions( resource_group_name: str, account_name: str, **kwargs - ) -> AsyncIterable["models.MetricDefinitionsListResult"]: + ) -> AsyncIterable["_models.MetricDefinitionsListResult"]: """Retrieves metric definitions for the given database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1483,12 +1525,12 @@ def list_metric_definitions( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_operations.py index 96d43a738e70..7e413bcc9584 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DatabaseOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_metrics( database_rid: str, filter: str, **kwargs - ) -> AsyncIterable["models.MetricListResult"]: + ) -> AsyncIterable["_models.MetricListResult"]: """Retrieves the metrics determined by the given filter for the given database account and database. @@ -67,12 +67,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -133,7 +133,7 @@ def list_usages( database_rid: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.UsagesResult"]: + ) -> AsyncIterable["_models.UsagesResult"]: """Retrieves the usages (most recent data) for the given database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -150,12 +150,12 @@ def list_usages( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.UsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -216,7 +216,7 @@ def list_metric_definitions( account_name: str, database_rid: str, **kwargs - ) -> AsyncIterable["models.MetricDefinitionsListResult"]: + ) -> AsyncIterable["_models.MetricDefinitionsListResult"]: """Retrieves metric definitions for the given database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -230,12 +230,12 @@ def list_metric_definitions( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_gremlin_resources_operations.py index 52412d042fb9..94260f3aba3e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_gremlin_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_gremlin_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class GremlinResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_gremlin_databases( resource_group_name: str, account_name: str, **kwargs - ) -> AsyncIterable["models.GremlinDatabaseListResult"]: + ) -> AsyncIterable["_models.GremlinDatabaseListResult"]: """Lists the Gremlin databases under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,12 +60,12 @@ def list_gremlin_databases( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinDatabaseListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinDatabaseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -123,7 +123,7 @@ async def get_gremlin_database( account_name: str, database_name: str, **kwargs - ) -> "models.GremlinDatabaseGetResults": + ) -> "_models.GremlinDatabaseGetResults": """Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. @@ -138,12 +138,12 @@ async def get_gremlin_database( :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinDatabaseGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -185,15 +185,15 @@ async def _create_update_gremlin_database_initial( resource_group_name: str, account_name: str, database_name: str, - create_update_gremlin_database_parameters: "models.GremlinDatabaseCreateUpdateParameters", + create_update_gremlin_database_parameters: "_models.GremlinDatabaseCreateUpdateParameters", **kwargs - ) -> Optional["models.GremlinDatabaseGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GremlinDatabaseGetResults"]] + ) -> Optional["_models.GremlinDatabaseGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GremlinDatabaseGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -242,9 +242,9 @@ async def begin_create_update_gremlin_database( resource_group_name: str, account_name: str, database_name: str, - create_update_gremlin_database_parameters: "models.GremlinDatabaseCreateUpdateParameters", + create_update_gremlin_database_parameters: "_models.GremlinDatabaseCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.GremlinDatabaseGetResults"]: + ) -> AsyncLROPoller["_models.GremlinDatabaseGetResults"]: """Create or update an Azure Cosmos DB Gremlin database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -267,7 +267,7 @@ async def begin_create_update_gremlin_database( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -293,7 +293,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -319,7 +326,7 @@ async def _delete_gremlin_database_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_gremlin_database_initial.metadata['url'] # type: ignore @@ -399,7 +406,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -419,7 +433,7 @@ async def get_gremlin_database_throughput( account_name: str, database_name: str, **kwargs - ) -> "models.ThroughputSettingsGetResults": + ) -> "_models.ThroughputSettingsGetResults": """Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. @@ -434,12 +448,12 @@ async def get_gremlin_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -481,15 +495,15 @@ async def _update_gremlin_database_throughput_initial( resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -538,9 +552,9 @@ async def begin_update_gremlin_database_throughput( resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Update RUs per second of an Azure Cosmos DB Gremlin database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -563,7 +577,7 @@ async def begin_update_gremlin_database_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -589,7 +603,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -609,13 +630,13 @@ async def _migrate_gremlin_database_to_autoscale_initial( account_name: str, database_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -642,7 +663,8 @@ async def _migrate_gremlin_database_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -660,7 +682,7 @@ async def begin_migrate_gremlin_database_to_autoscale( account_name: str, database_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -680,7 +702,7 @@ async def begin_migrate_gremlin_database_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -705,7 +727,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -725,13 +754,13 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( account_name: str, database_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -758,7 +787,8 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -776,7 +806,7 @@ async def begin_migrate_gremlin_database_to_manual_throughput( account_name: str, database_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -796,7 +826,7 @@ async def begin_migrate_gremlin_database_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -821,7 +851,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -841,7 +878,7 @@ def list_gremlin_graphs( account_name: str, database_name: str, **kwargs - ) -> AsyncIterable["models.GremlinGraphListResult"]: + ) -> AsyncIterable["_models.GremlinGraphListResult"]: """Lists the Gremlin graph under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -855,12 +892,12 @@ def list_gremlin_graphs( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinGraphListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinGraphListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -920,7 +957,7 @@ async def get_gremlin_graph( database_name: str, graph_name: str, **kwargs - ) -> "models.GremlinGraphGetResults": + ) -> "_models.GremlinGraphGetResults": """Gets the Gremlin graph under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -936,12 +973,12 @@ async def get_gremlin_graph( :rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinGraphGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinGraphGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -985,15 +1022,15 @@ async def _create_update_gremlin_graph_initial( account_name: str, database_name: str, graph_name: str, - create_update_gremlin_graph_parameters: "models.GremlinGraphCreateUpdateParameters", + create_update_gremlin_graph_parameters: "_models.GremlinGraphCreateUpdateParameters", **kwargs - ) -> Optional["models.GremlinGraphGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GremlinGraphGetResults"]] + ) -> Optional["_models.GremlinGraphGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GremlinGraphGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1044,9 +1081,9 @@ async def begin_create_update_gremlin_graph( account_name: str, database_name: str, graph_name: str, - create_update_gremlin_graph_parameters: "models.GremlinGraphCreateUpdateParameters", + create_update_gremlin_graph_parameters: "_models.GremlinGraphCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.GremlinGraphGetResults"]: + ) -> AsyncLROPoller["_models.GremlinGraphGetResults"]: """Create or update an Azure Cosmos DB Gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1071,7 +1108,7 @@ async def begin_create_update_gremlin_graph( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinGraphGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinGraphGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1098,7 +1135,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1125,7 +1170,7 @@ async def _delete_gremlin_graph_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_gremlin_graph_initial.metadata['url'] # type: ignore @@ -1210,7 +1255,15 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1231,7 +1284,7 @@ async def get_gremlin_graph_throughput( database_name: str, graph_name: str, **kwargs - ) -> "models.ThroughputSettingsGetResults": + ) -> "_models.ThroughputSettingsGetResults": """Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. @@ -1248,12 +1301,12 @@ async def get_gremlin_graph_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1297,15 +1350,15 @@ async def _update_gremlin_graph_throughput_initial( account_name: str, database_name: str, graph_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1356,9 +1409,9 @@ async def begin_update_gremlin_graph_throughput( account_name: str, database_name: str, graph_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Update RUs per second of an Azure Cosmos DB Gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1383,7 +1436,7 @@ async def begin_update_gremlin_graph_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1410,7 +1463,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1431,13 +1492,13 @@ async def _migrate_gremlin_graph_to_autoscale_initial( database_name: str, graph_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1465,7 +1526,8 @@ async def _migrate_gremlin_graph_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1484,7 +1546,7 @@ async def begin_migrate_gremlin_graph_to_autoscale( database_name: str, graph_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1506,7 +1568,7 @@ async def begin_migrate_gremlin_graph_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1532,7 +1594,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1553,13 +1623,13 @@ async def _migrate_gremlin_graph_to_manual_throughput_initial( database_name: str, graph_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1587,7 +1657,8 @@ async def _migrate_gremlin_graph_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1606,7 +1677,7 @@ async def begin_migrate_gremlin_graph_to_manual_throughput( database_name: str, graph_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1628,7 +1699,7 @@ async def begin_migrate_gremlin_graph_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1654,7 +1725,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_mongo_db_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_mongo_db_resources_operations.py index cd0942daaf9f..422d17ff7364 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_mongo_db_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_mongo_db_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class MongoDBResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_mongo_db_databases( resource_group_name: str, account_name: str, **kwargs - ) -> AsyncIterable["models.MongoDBDatabaseListResult"]: + ) -> AsyncIterable["_models.MongoDBDatabaseListResult"]: """Lists the MongoDB databases under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,12 +60,12 @@ def list_mongo_db_databases( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBDatabaseListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBDatabaseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -123,7 +123,7 @@ async def get_mongo_db_database( account_name: str, database_name: str, **kwargs - ) -> "models.MongoDBDatabaseGetResults": + ) -> "_models.MongoDBDatabaseGetResults": """Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. @@ -138,12 +138,12 @@ async def get_mongo_db_database( :rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBDatabaseGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -185,15 +185,15 @@ async def _create_update_mongo_db_database_initial( resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: "models.MongoDBDatabaseCreateUpdateParameters", + create_update_mongo_db_database_parameters: "_models.MongoDBDatabaseCreateUpdateParameters", **kwargs - ) -> Optional["models.MongoDBDatabaseGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MongoDBDatabaseGetResults"]] + ) -> Optional["_models.MongoDBDatabaseGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoDBDatabaseGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -242,9 +242,9 @@ async def begin_create_update_mongo_db_database( resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: "models.MongoDBDatabaseCreateUpdateParameters", + create_update_mongo_db_database_parameters: "_models.MongoDBDatabaseCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.MongoDBDatabaseGetResults"]: + ) -> AsyncLROPoller["_models.MongoDBDatabaseGetResults"]: """Create or updates Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -267,7 +267,7 @@ async def begin_create_update_mongo_db_database( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -293,7 +293,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -319,7 +326,7 @@ async def _delete_mongo_db_database_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_mongo_db_database_initial.metadata['url'] # type: ignore @@ -399,7 +406,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -419,7 +433,7 @@ async def get_mongo_db_database_throughput( account_name: str, database_name: str, **kwargs - ) -> "models.ThroughputSettingsGetResults": + ) -> "_models.ThroughputSettingsGetResults": """Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. @@ -434,12 +448,12 @@ async def get_mongo_db_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -481,15 +495,15 @@ async def _update_mongo_db_database_throughput_initial( resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -521,7 +535,8 @@ async def _update_mongo_db_database_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -538,9 +553,9 @@ async def begin_update_mongo_db_database_throughput( resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Update RUs per second of the an Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -563,7 +578,7 @@ async def begin_update_mongo_db_database_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -589,7 +604,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -609,13 +631,13 @@ async def _migrate_mongo_db_database_to_autoscale_initial( account_name: str, database_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -642,7 +664,8 @@ async def _migrate_mongo_db_database_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -660,7 +683,7 @@ async def begin_migrate_mongo_db_database_to_autoscale( account_name: str, database_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -680,7 +703,7 @@ async def begin_migrate_mongo_db_database_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -705,7 +728,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -725,13 +755,13 @@ async def _migrate_mongo_db_database_to_manual_throughput_initial( account_name: str, database_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -758,7 +788,8 @@ async def _migrate_mongo_db_database_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -776,7 +807,7 @@ async def begin_migrate_mongo_db_database_to_manual_throughput( account_name: str, database_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -796,7 +827,7 @@ async def begin_migrate_mongo_db_database_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -821,7 +852,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -841,7 +879,7 @@ def list_mongo_db_collections( account_name: str, database_name: str, **kwargs - ) -> AsyncIterable["models.MongoDBCollectionListResult"]: + ) -> AsyncIterable["_models.MongoDBCollectionListResult"]: """Lists the MongoDB collection under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -855,12 +893,12 @@ def list_mongo_db_collections( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBCollectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -920,7 +958,7 @@ async def get_mongo_db_collection( database_name: str, collection_name: str, **kwargs - ) -> "models.MongoDBCollectionGetResults": + ) -> "_models.MongoDBCollectionGetResults": """Gets the MongoDB collection under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -936,12 +974,12 @@ async def get_mongo_db_collection( :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBCollectionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBCollectionGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -985,15 +1023,15 @@ async def _create_update_mongo_db_collection_initial( account_name: str, database_name: str, collection_name: str, - create_update_mongo_db_collection_parameters: "models.MongoDBCollectionCreateUpdateParameters", + create_update_mongo_db_collection_parameters: "_models.MongoDBCollectionCreateUpdateParameters", **kwargs - ) -> Optional["models.MongoDBCollectionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MongoDBCollectionGetResults"]] + ) -> Optional["_models.MongoDBCollectionGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoDBCollectionGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1044,9 +1082,9 @@ async def begin_create_update_mongo_db_collection( account_name: str, database_name: str, collection_name: str, - create_update_mongo_db_collection_parameters: "models.MongoDBCollectionCreateUpdateParameters", + create_update_mongo_db_collection_parameters: "_models.MongoDBCollectionCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.MongoDBCollectionGetResults"]: + ) -> AsyncLROPoller["_models.MongoDBCollectionGetResults"]: """Create or update an Azure Cosmos DB MongoDB Collection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1071,7 +1109,7 @@ async def begin_create_update_mongo_db_collection( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBCollectionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBCollectionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1098,7 +1136,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1125,7 +1171,7 @@ async def _delete_mongo_db_collection_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_mongo_db_collection_initial.metadata['url'] # type: ignore @@ -1210,7 +1256,15 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1231,7 +1285,7 @@ async def get_mongo_db_collection_throughput( database_name: str, collection_name: str, **kwargs - ) -> "models.ThroughputSettingsGetResults": + ) -> "_models.ThroughputSettingsGetResults": """Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. @@ -1248,12 +1302,12 @@ async def get_mongo_db_collection_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1297,15 +1351,15 @@ async def _update_mongo_db_collection_throughput_initial( account_name: str, database_name: str, collection_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1356,9 +1410,9 @@ async def begin_update_mongo_db_collection_throughput( account_name: str, database_name: str, collection_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1383,7 +1437,7 @@ async def begin_update_mongo_db_collection_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1410,7 +1464,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1431,13 +1493,13 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( database_name: str, collection_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1465,7 +1527,8 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1484,7 +1547,7 @@ async def begin_migrate_mongo_db_collection_to_autoscale( database_name: str, collection_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1506,7 +1569,7 @@ async def begin_migrate_mongo_db_collection_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1532,7 +1595,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1553,13 +1624,13 @@ async def _migrate_mongo_db_collection_to_manual_throughput_initial( database_name: str, collection_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1587,7 +1658,8 @@ async def _migrate_mongo_db_collection_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1606,7 +1678,7 @@ async def begin_migrate_mongo_db_collection_to_manual_throughput( database_name: str, collection_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1628,7 +1700,7 @@ async def begin_migrate_mongo_db_collection_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1654,7 +1726,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_notebook_workspaces_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_notebook_workspaces_operations.py index fb27691cd37b..ce3e2f98c7d7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_notebook_workspaces_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_notebook_workspaces_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class NotebookWorkspacesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_by_database_account( resource_group_name: str, account_name: str, **kwargs - ) -> AsyncIterable["models.NotebookWorkspaceListResult"]: + ) -> AsyncIterable["_models.NotebookWorkspaceListResult"]: """Gets the notebook workspace resources of an existing Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,12 +60,12 @@ def list_by_database_account( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.NotebookWorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspaceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspaceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -107,7 +107,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -122,9 +122,9 @@ async def get( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs - ) -> "models.NotebookWorkspace": + ) -> "_models.NotebookWorkspace": """Gets the notebook workspace for a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -138,12 +138,12 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspace"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -170,7 +170,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotebookWorkspace', pipeline_response) @@ -185,16 +185,16 @@ async def _create_or_update_initial( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], - notebook_create_update_parameters: "models.ARMProxyResource", + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], + notebook_create_update_parameters: "_models.ARMProxyResource", **kwargs - ) -> "models.NotebookWorkspace": - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspace"] + ) -> "_models.NotebookWorkspace": + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -226,7 +226,7 @@ async def _create_or_update_initial( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotebookWorkspace', pipeline_response) @@ -241,10 +241,10 @@ async def begin_create_or_update( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], - notebook_create_update_parameters: "models.ARMProxyResource", + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], + notebook_create_update_parameters: "_models.ARMProxyResource", **kwargs - ) -> AsyncLROPoller["models.NotebookWorkspace"]: + ) -> AsyncLROPoller["_models.NotebookWorkspace"]: """Creates the notebook workspace for a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -267,7 +267,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspace"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -293,7 +293,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("notebook_workspace_name", notebook_workspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -311,7 +318,7 @@ async def _delete_initial( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -319,7 +326,7 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -346,7 +353,7 @@ async def _delete_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -358,7 +365,7 @@ async def begin_delete( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs ) -> AsyncLROPoller[None]: """Deletes the notebook workspace for a Cosmos DB account. @@ -402,7 +409,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("notebook_workspace_name", notebook_workspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,9 +434,9 @@ async def list_connection_info( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs - ) -> "models.NotebookWorkspaceConnectionInfoResult": + ) -> "_models.NotebookWorkspaceConnectionInfoResult": """Retrieves the connection info for the notebook workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -436,12 +450,12 @@ async def list_connection_info( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspaceConnectionInfoResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspaceConnectionInfoResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -468,7 +482,7 @@ async def list_connection_info( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotebookWorkspaceConnectionInfoResult', pipeline_response) @@ -483,7 +497,7 @@ async def _regenerate_auth_token_initial( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -491,7 +505,7 @@ async def _regenerate_auth_token_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -518,7 +532,7 @@ async def _regenerate_auth_token_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -530,7 +544,7 @@ async def begin_regenerate_auth_token( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs ) -> AsyncLROPoller[None]: """Regenerates the auth token for the notebook workspace. @@ -574,7 +588,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("notebook_workspace_name", notebook_workspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -592,7 +613,7 @@ async def _start_initial( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -600,7 +621,7 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -627,7 +648,7 @@ async def _start_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -639,7 +660,7 @@ async def begin_start( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, "models.NotebookWorkspaceName"], + notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs ) -> AsyncLROPoller[None]: """Starts the notebook workspace. @@ -683,7 +704,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("notebook_workspace_name", notebook_workspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_operations.py index 90ffecaf36b6..a6b8cd94289d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Cosmos DB Resource Provider operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,12 +52,12 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_operations.py index ea0a3250e2d2..00b6e7bb71d6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PartitionKeyRangeIdOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_metrics( partition_key_range_id: str, filter: str, **kwargs - ) -> AsyncIterable["models.PartitionMetricListResult"]: + ) -> AsyncIterable["_models.PartitionMetricListResult"]: """Retrieves the metrics determined by the given filter for the given partition key range id. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -72,12 +72,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_region_operations.py index 11d9f6135431..1f1ba2ca6c4e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_region_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PartitionKeyRangeIdRegionOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -51,7 +51,7 @@ def list_metrics( partition_key_range_id: str, filter: str, **kwargs - ) -> AsyncIterable["models.PartitionMetricListResult"]: + ) -> AsyncIterable["_models.PartitionMetricListResult"]: """Retrieves the metrics determined by the given filter for the given partition key range id and region. @@ -76,12 +76,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_operations.py index aaf18f52dea5..881c83f55066 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PercentileOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ def list_metrics( account_name: str, filter: str, **kwargs - ) -> AsyncIterable["models.PercentileMetricListResult"]: + ) -> AsyncIterable["_models.PercentileMetricListResult"]: """Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. @@ -64,12 +64,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PercentileMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PercentileMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_source_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_source_target_operations.py index d763c4d2c47b..20b800b4151b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_source_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_source_target_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PercentileSourceTargetOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,7 +49,7 @@ def list_metrics( target_region: str, filter: str, **kwargs - ) -> AsyncIterable["models.PercentileMetricListResult"]: + ) -> AsyncIterable["_models.PercentileMetricListResult"]: """Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. @@ -72,12 +72,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PercentileMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PercentileMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_target_operations.py index 23386faf5f2c..e21cb81550cc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_target_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PercentileTargetOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_metrics( target_region: str, filter: str, **kwargs - ) -> AsyncIterable["models.PercentileMetricListResult"]: + ) -> AsyncIterable["_models.PercentileMetricListResult"]: """Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. @@ -68,12 +68,12 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PercentileMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PercentileMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_endpoint_connections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_endpoint_connections_operations.py index 4e31f222fe29..dddb08d94484 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_endpoint_connections_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_by_database_account( resource_group_name: str, account_name: str, **kwargs - ) -> AsyncIterable["models.PrivateEndpointConnectionListResult"]: + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: """List all private endpoint connections on a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,12 +60,12 @@ def list_by_database_account( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -123,7 +123,7 @@ async def get( account_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnectionAutoGenerated": + ) -> "_models.PrivateEndpointConnection": """Gets a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -133,16 +133,16 @@ async def get( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionAutoGenerated, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionAutoGenerated + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionAutoGenerated"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -171,7 +171,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionAutoGenerated', pipeline_response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -184,15 +184,15 @@ async def _create_or_update_initial( resource_group_name: str, account_name: str, private_endpoint_connection_name: str, - parameters: "models.PrivateEndpointConnectionAutoGenerated", + parameters: "_models.PrivateEndpointConnection", **kwargs - ) -> Optional["models.PrivateEndpointConnectionAutoGenerated"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnectionAutoGenerated"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -216,7 +216,7 @@ async def _create_or_update_initial( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnectionAutoGenerated') + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -224,12 +224,12 @@ async def _create_or_update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnectionAutoGenerated', pipeline_response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -242,9 +242,9 @@ async def begin_create_or_update( resource_group_name: str, account_name: str, private_endpoint_connection_name: str, - parameters: "models.PrivateEndpointConnectionAutoGenerated", + parameters: "_models.PrivateEndpointConnection", **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnectionAutoGenerated"]: + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Approve or reject a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -254,19 +254,19 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param parameters: - :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionAutoGenerated + :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnectionAutoGenerated or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionAutoGenerated] + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionAutoGenerated"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -286,13 +286,20 @@ async def begin_create_or_update( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionAutoGenerated', pipeline_response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,7 +325,7 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -345,7 +352,7 @@ async def _delete_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -401,7 +408,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_link_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_link_resources_operations.py index b0af145eeb14..4f0c72acdd15 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_link_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_link_resources_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def list_by_database_account( resource_group_name: str, account_name: str, **kwargs - ) -> AsyncIterable["models.PrivateLinkResourceListResult"]: + ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: """Gets the private link resources that need to be created for a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -58,12 +58,12 @@ def list_by_database_account( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -121,7 +121,7 @@ async def get( account_name: str, group_name: str, **kwargs - ) -> "models.PrivateLinkResource": + ) -> "_models.PrivateLinkResource": """Gets the private link resources that need to be created for a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -135,12 +135,12 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" # Construct URL diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_sql_resources_operations.py index 79213d23fedf..c4c33c7df46d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_sql_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_sql_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class SqlResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_sql_databases( resource_group_name: str, account_name: str, **kwargs - ) -> AsyncIterable["models.SqlDatabaseListResult"]: + ) -> AsyncIterable["_models.SqlDatabaseListResult"]: """Lists the SQL databases under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,12 +60,12 @@ def list_sql_databases( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlDatabaseListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlDatabaseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -123,7 +123,7 @@ async def get_sql_database( account_name: str, database_name: str, **kwargs - ) -> "models.SqlDatabaseGetResults": + ) -> "_models.SqlDatabaseGetResults": """Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. @@ -138,12 +138,12 @@ async def get_sql_database( :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlDatabaseGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -185,15 +185,15 @@ async def _create_update_sql_database_initial( resource_group_name: str, account_name: str, database_name: str, - create_update_sql_database_parameters: "models.SqlDatabaseCreateUpdateParameters", + create_update_sql_database_parameters: "_models.SqlDatabaseCreateUpdateParameters", **kwargs - ) -> Optional["models.SqlDatabaseGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlDatabaseGetResults"]] + ) -> Optional["_models.SqlDatabaseGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlDatabaseGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -242,9 +242,9 @@ async def begin_create_update_sql_database( resource_group_name: str, account_name: str, database_name: str, - create_update_sql_database_parameters: "models.SqlDatabaseCreateUpdateParameters", + create_update_sql_database_parameters: "_models.SqlDatabaseCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.SqlDatabaseGetResults"]: + ) -> AsyncLROPoller["_models.SqlDatabaseGetResults"]: """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -267,7 +267,7 @@ async def begin_create_update_sql_database( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -293,7 +293,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -319,7 +326,7 @@ async def _delete_sql_database_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_database_initial.metadata['url'] # type: ignore @@ -399,7 +406,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -419,7 +433,7 @@ async def get_sql_database_throughput( account_name: str, database_name: str, **kwargs - ) -> "models.ThroughputSettingsGetResults": + ) -> "_models.ThroughputSettingsGetResults": """Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. @@ -434,12 +448,12 @@ async def get_sql_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -481,15 +495,15 @@ async def _update_sql_database_throughput_initial( resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -538,9 +552,9 @@ async def begin_update_sql_database_throughput( resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -563,7 +577,7 @@ async def begin_update_sql_database_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -589,7 +603,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -609,13 +630,13 @@ async def _migrate_sql_database_to_autoscale_initial( account_name: str, database_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -642,7 +663,8 @@ async def _migrate_sql_database_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -660,7 +682,7 @@ async def begin_migrate_sql_database_to_autoscale( account_name: str, database_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -680,7 +702,7 @@ async def begin_migrate_sql_database_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -705,7 +727,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -725,13 +754,13 @@ async def _migrate_sql_database_to_manual_throughput_initial( account_name: str, database_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -758,7 +787,8 @@ async def _migrate_sql_database_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -776,7 +806,7 @@ async def begin_migrate_sql_database_to_manual_throughput( account_name: str, database_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -796,7 +826,7 @@ async def begin_migrate_sql_database_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -821,7 +851,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -841,7 +878,7 @@ def list_sql_containers( account_name: str, database_name: str, **kwargs - ) -> AsyncIterable["models.SqlContainerListResult"]: + ) -> AsyncIterable["_models.SqlContainerListResult"]: """Lists the SQL container under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -855,12 +892,12 @@ def list_sql_containers( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlContainerListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -920,7 +957,7 @@ async def get_sql_container( database_name: str, container_name: str, **kwargs - ) -> "models.SqlContainerGetResults": + ) -> "_models.SqlContainerGetResults": """Gets the SQL container under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -936,12 +973,12 @@ async def get_sql_container( :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlContainerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -985,15 +1022,15 @@ async def _create_update_sql_container_initial( account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: "models.SqlContainerCreateUpdateParameters", + create_update_sql_container_parameters: "_models.SqlContainerCreateUpdateParameters", **kwargs - ) -> Optional["models.SqlContainerGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlContainerGetResults"]] + ) -> Optional["_models.SqlContainerGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlContainerGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1044,9 +1081,9 @@ async def begin_create_update_sql_container( account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: "models.SqlContainerCreateUpdateParameters", + create_update_sql_container_parameters: "_models.SqlContainerCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.SqlContainerGetResults"]: + ) -> AsyncLROPoller["_models.SqlContainerGetResults"]: """Create or update an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1071,7 +1108,7 @@ async def begin_create_update_sql_container( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlContainerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1098,7 +1135,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1125,7 +1170,7 @@ async def _delete_sql_container_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_container_initial.metadata['url'] # type: ignore @@ -1210,7 +1255,15 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1231,7 +1284,7 @@ async def get_sql_container_throughput( database_name: str, container_name: str, **kwargs - ) -> "models.ThroughputSettingsGetResults": + ) -> "_models.ThroughputSettingsGetResults": """Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. @@ -1248,12 +1301,12 @@ async def get_sql_container_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1297,15 +1350,15 @@ async def _update_sql_container_throughput_initial( account_name: str, database_name: str, container_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1356,9 +1409,9 @@ async def begin_update_sql_container_throughput( account_name: str, database_name: str, container_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Update RUs per second of an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1383,7 +1436,7 @@ async def begin_update_sql_container_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1410,7 +1463,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1431,13 +1492,13 @@ async def _migrate_sql_container_to_autoscale_initial( database_name: str, container_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1465,7 +1526,8 @@ async def _migrate_sql_container_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1484,7 +1546,7 @@ async def begin_migrate_sql_container_to_autoscale( database_name: str, container_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1506,7 +1568,7 @@ async def begin_migrate_sql_container_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1532,7 +1594,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1553,13 +1623,13 @@ async def _migrate_sql_container_to_manual_throughput_initial( database_name: str, container_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1587,7 +1657,8 @@ async def _migrate_sql_container_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1606,7 +1677,7 @@ async def begin_migrate_sql_container_to_manual_throughput( database_name: str, container_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1628,7 +1699,7 @@ async def begin_migrate_sql_container_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1654,7 +1725,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1675,7 +1754,7 @@ def list_sql_stored_procedures( database_name: str, container_name: str, **kwargs - ) -> AsyncIterable["models.SqlStoredProcedureListResult"]: + ) -> AsyncIterable["_models.SqlStoredProcedureListResult"]: """Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1691,12 +1770,12 @@ def list_sql_stored_procedures( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlStoredProcedureListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlStoredProcedureListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlStoredProcedureListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -1740,8 +1819,9 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1758,7 +1838,7 @@ async def get_sql_stored_procedure( container_name: str, stored_procedure_name: str, **kwargs - ) -> "models.SqlStoredProcedureGetResults": + ) -> "_models.SqlStoredProcedureGetResults": """Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1776,12 +1856,12 @@ async def get_sql_stored_procedure( :rtype: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlStoredProcedureGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlStoredProcedureGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1827,15 +1907,15 @@ async def _create_update_sql_stored_procedure_initial( database_name: str, container_name: str, stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: "models.SqlStoredProcedureCreateUpdateParameters", + create_update_sql_stored_procedure_parameters: "_models.SqlStoredProcedureCreateUpdateParameters", **kwargs - ) -> Optional["models.SqlStoredProcedureGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlStoredProcedureGetResults"]] + ) -> Optional["_models.SqlStoredProcedureGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlStoredProcedureGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1888,9 +1968,9 @@ async def begin_create_update_sql_stored_procedure( database_name: str, container_name: str, stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: "models.SqlStoredProcedureCreateUpdateParameters", + create_update_sql_stored_procedure_parameters: "_models.SqlStoredProcedureCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.SqlStoredProcedureGetResults"]: + ) -> AsyncLROPoller["_models.SqlStoredProcedureGetResults"]: """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1917,7 +1997,7 @@ async def begin_create_update_sql_stored_procedure( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlStoredProcedureGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlStoredProcedureGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1945,7 +2025,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1973,7 +2062,7 @@ async def _delete_sql_stored_procedure_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_stored_procedure_initial.metadata['url'] # type: ignore @@ -2063,7 +2152,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2084,7 +2182,7 @@ def list_sql_user_defined_functions( database_name: str, container_name: str, **kwargs - ) -> AsyncIterable["models.SqlUserDefinedFunctionListResult"]: + ) -> AsyncIterable["_models.SqlUserDefinedFunctionListResult"]: """Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2100,12 +2198,12 @@ def list_sql_user_defined_functions( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlUserDefinedFunctionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlUserDefinedFunctionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -2167,7 +2265,7 @@ async def get_sql_user_defined_function( container_name: str, user_defined_function_name: str, **kwargs - ) -> "models.SqlUserDefinedFunctionGetResults": + ) -> "_models.SqlUserDefinedFunctionGetResults": """Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2185,12 +2283,12 @@ async def get_sql_user_defined_function( :rtype: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlUserDefinedFunctionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlUserDefinedFunctionGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -2236,15 +2334,15 @@ async def _create_update_sql_user_defined_function_initial( database_name: str, container_name: str, user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: "models.SqlUserDefinedFunctionCreateUpdateParameters", + create_update_sql_user_defined_function_parameters: "_models.SqlUserDefinedFunctionCreateUpdateParameters", **kwargs - ) -> Optional["models.SqlUserDefinedFunctionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlUserDefinedFunctionGetResults"]] + ) -> Optional["_models.SqlUserDefinedFunctionGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlUserDefinedFunctionGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -2297,9 +2395,9 @@ async def begin_create_update_sql_user_defined_function( database_name: str, container_name: str, user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: "models.SqlUserDefinedFunctionCreateUpdateParameters", + create_update_sql_user_defined_function_parameters: "_models.SqlUserDefinedFunctionCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.SqlUserDefinedFunctionGetResults"]: + ) -> AsyncLROPoller["_models.SqlUserDefinedFunctionGetResults"]: """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2326,7 +2424,7 @@ async def begin_create_update_sql_user_defined_function( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlUserDefinedFunctionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlUserDefinedFunctionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2354,7 +2452,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2382,7 +2489,7 @@ async def _delete_sql_user_defined_function_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_user_defined_function_initial.metadata['url'] # type: ignore @@ -2472,7 +2579,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2493,7 +2609,7 @@ def list_sql_triggers( database_name: str, container_name: str, **kwargs - ) -> AsyncIterable["models.SqlTriggerListResult"]: + ) -> AsyncIterable["_models.SqlTriggerListResult"]: """Lists the SQL trigger under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2509,12 +2625,12 @@ def list_sql_triggers( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlTriggerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlTriggerListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlTriggerListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -2576,7 +2692,7 @@ async def get_sql_trigger( container_name: str, trigger_name: str, **kwargs - ) -> "models.SqlTriggerGetResults": + ) -> "_models.SqlTriggerGetResults": """Gets the SQL trigger under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2594,12 +2710,12 @@ async def get_sql_trigger( :rtype: ~azure.mgmt.cosmosdb.models.SqlTriggerGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlTriggerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlTriggerGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -2645,15 +2761,15 @@ async def _create_update_sql_trigger_initial( database_name: str, container_name: str, trigger_name: str, - create_update_sql_trigger_parameters: "models.SqlTriggerCreateUpdateParameters", + create_update_sql_trigger_parameters: "_models.SqlTriggerCreateUpdateParameters", **kwargs - ) -> Optional["models.SqlTriggerGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlTriggerGetResults"]] + ) -> Optional["_models.SqlTriggerGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlTriggerGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -2706,9 +2822,9 @@ async def begin_create_update_sql_trigger( database_name: str, container_name: str, trigger_name: str, - create_update_sql_trigger_parameters: "models.SqlTriggerCreateUpdateParameters", + create_update_sql_trigger_parameters: "_models.SqlTriggerCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.SqlTriggerGetResults"]: + ) -> AsyncLROPoller["_models.SqlTriggerGetResults"]: """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2735,7 +2851,7 @@ async def begin_create_update_sql_trigger( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlTriggerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlTriggerGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2763,7 +2879,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2791,7 +2916,7 @@ async def _delete_sql_trigger_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_trigger_initial.metadata['url'] # type: ignore @@ -2881,7 +3006,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_table_resources_operations.py index 517f5fe2aef0..36ed759a36fc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_table_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_table_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class TableResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ def list_tables( resource_group_name: str, account_name: str, **kwargs - ) -> AsyncIterable["models.TableListResult"]: + ) -> AsyncIterable["_models.TableListResult"]: """Lists the Tables under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,12 +60,12 @@ def list_tables( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TableListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -123,7 +123,7 @@ async def get_table( account_name: str, table_name: str, **kwargs - ) -> "models.TableGetResults": + ) -> "_models.TableGetResults": """Gets the Tables under an existing Azure Cosmos DB database account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -137,12 +137,12 @@ async def get_table( :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -184,15 +184,15 @@ async def _create_update_table_initial( resource_group_name: str, account_name: str, table_name: str, - create_update_table_parameters: "models.TableCreateUpdateParameters", + create_update_table_parameters: "_models.TableCreateUpdateParameters", **kwargs - ) -> Optional["models.TableGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TableGetResults"]] + ) -> Optional["_models.TableGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.TableGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -241,9 +241,9 @@ async def begin_create_update_table( resource_group_name: str, account_name: str, table_name: str, - create_update_table_parameters: "models.TableCreateUpdateParameters", + create_update_table_parameters: "_models.TableCreateUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.TableGetResults"]: + ) -> AsyncLROPoller["_models.TableGetResults"]: """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -265,7 +265,7 @@ async def begin_create_update_table( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.TableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -291,7 +291,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,7 +324,7 @@ async def _delete_table_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_table_initial.metadata['url'] # type: ignore @@ -397,7 +404,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -417,7 +431,7 @@ async def get_table_throughput( account_name: str, table_name: str, **kwargs - ) -> "models.ThroughputSettingsGetResults": + ) -> "_models.ThroughputSettingsGetResults": """Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. @@ -432,12 +446,12 @@ async def get_table_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -479,15 +493,15 @@ async def _update_table_throughput_initial( resource_group_name: str, account_name: str, table_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -536,9 +550,9 @@ async def begin_update_table_throughput( resource_group_name: str, account_name: str, table_name: str, - update_throughput_parameters: "models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -561,7 +575,7 @@ async def begin_update_table_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -587,7 +601,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -607,13 +628,13 @@ async def _migrate_table_to_autoscale_initial( account_name: str, table_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -640,7 +661,8 @@ async def _migrate_table_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -658,7 +680,7 @@ async def begin_migrate_table_to_autoscale( account_name: str, table_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Table from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -678,7 +700,7 @@ async def begin_migrate_table_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -703,7 +725,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -723,13 +752,13 @@ async def _migrate_table_to_manual_throughput_initial( account_name: str, table_name: str, **kwargs - ) -> Optional["models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + ) -> Optional["_models.ThroughputSettingsGetResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -756,7 +785,8 @@ async def _migrate_table_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -774,7 +804,7 @@ async def begin_migrate_table_to_manual_throughput( account_name: str, table_name: str, **kwargs - ) -> AsyncLROPoller["models.ThroughputSettingsGetResults"]: + ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: """Migrate an Azure Cosmos DB Table from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -794,7 +824,7 @@ async def begin_migrate_table_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -819,7 +849,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: 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 d544529f2da6..81e37edc6ba9 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 @@ -13,6 +13,7 @@ from ._models_py3 import AutoUpgradePolicyResource from ._models_py3 import AutoscaleSettings from ._models_py3 import AutoscaleSettingsResource + from ._models_py3 import BackupPolicy from ._models_py3 import Capability from ._models_py3 import CassandraKeyspaceCreateUpdateParameters from ._models_py3 import CassandraKeyspaceGetPropertiesOptions @@ -30,10 +31,12 @@ from ._models_py3 import CassandraTableResource from ._models_py3 import ClusterKey from ._models_py3 import Column + from ._models_py3 import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties from ._models_py3 import CompositePath from ._models_py3 import ConflictResolutionPolicy from ._models_py3 import ConsistencyPolicy from ._models_py3 import ContainerPartitionKey + from ._models_py3 import ContinuousModeBackupPolicy from ._models_py3 import CorsPolicy from ._models_py3 import CreateUpdateOptions from ._models_py3 import DatabaseAccountConnectionString @@ -45,7 +48,10 @@ from ._models_py3 import DatabaseAccountRegenerateKeyParameters from ._models_py3 import DatabaseAccountUpdateParameters from ._models_py3 import DatabaseAccountsListResult + from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorResponse + from ._models_py3 import ErrorResponseAutoGenerated + from ._models_py3 import ErrorResponseUpdatedFormat from ._models_py3 import ExcludedPath from ._models_py3 import ExtendedResourceProperties from ._models_py3 import FailoverPolicies @@ -67,6 +73,7 @@ from ._models_py3 import IndexingPolicy from ._models_py3 import IpAddressOrRange from ._models_py3 import Location + from ._models_py3 import ManagedServiceIdentity from ._models_py3 import Metric from ._models_py3 import MetricAvailability from ._models_py3 import MetricDefinition @@ -104,14 +111,14 @@ from ._models_py3 import PercentileMetric from ._models_py3 import PercentileMetricListResult from ._models_py3 import PercentileMetricValue + from ._models_py3 import PeriodicModeBackupPolicy + from ._models_py3 import PeriodicModeProperties from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionAutoGenerated from ._models_py3 import PrivateEndpointConnectionListResult from ._models_py3 import PrivateEndpointProperty from ._models_py3 import PrivateLinkResource from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkServiceConnectionStateProperty - from ._models_py3 import PrivateLinkServiceConnectionStatePropertyAutoGenerated from ._models_py3 import ProxyResource from ._models_py3 import RegionForOnlineOffline from ._models_py3 import Resource @@ -166,6 +173,7 @@ from ._models import AutoUpgradePolicyResource # type: ignore from ._models import AutoscaleSettings # type: ignore from ._models import AutoscaleSettingsResource # type: ignore + from ._models import BackupPolicy # type: ignore from ._models import Capability # type: ignore from ._models import CassandraKeyspaceCreateUpdateParameters # type: ignore from ._models import CassandraKeyspaceGetPropertiesOptions # type: ignore @@ -183,10 +191,12 @@ from ._models import CassandraTableResource # type: ignore from ._models import ClusterKey # type: ignore from ._models import Column # type: ignore + from ._models import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore from ._models import CompositePath # type: ignore from ._models import ConflictResolutionPolicy # type: ignore from ._models import ConsistencyPolicy # type: ignore from ._models import ContainerPartitionKey # type: ignore + from ._models import ContinuousModeBackupPolicy # type: ignore from ._models import CorsPolicy # type: ignore from ._models import CreateUpdateOptions # type: ignore from ._models import DatabaseAccountConnectionString # type: ignore @@ -198,7 +208,10 @@ from ._models import DatabaseAccountRegenerateKeyParameters # type: ignore from ._models import DatabaseAccountUpdateParameters # type: ignore from ._models import DatabaseAccountsListResult # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore from ._models import ErrorResponse # type: ignore + from ._models import ErrorResponseAutoGenerated # type: ignore + from ._models import ErrorResponseUpdatedFormat # type: ignore from ._models import ExcludedPath # type: ignore from ._models import ExtendedResourceProperties # type: ignore from ._models import FailoverPolicies # type: ignore @@ -220,6 +233,7 @@ from ._models import IndexingPolicy # type: ignore from ._models import IpAddressOrRange # type: ignore from ._models import Location # type: ignore + from ._models import ManagedServiceIdentity # type: ignore from ._models import Metric # type: ignore from ._models import MetricAvailability # type: ignore from ._models import MetricDefinition # type: ignore @@ -257,14 +271,14 @@ from ._models import PercentileMetric # type: ignore from ._models import PercentileMetricListResult # type: ignore from ._models import PercentileMetricValue # type: ignore + from ._models import PeriodicModeBackupPolicy # type: ignore + from ._models import PeriodicModeProperties # type: ignore from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionAutoGenerated # type: ignore from ._models import PrivateEndpointConnectionListResult # type: ignore from ._models import PrivateEndpointProperty # type: ignore from ._models import PrivateLinkResource # type: ignore from ._models import PrivateLinkResourceListResult # type: ignore from ._models import PrivateLinkServiceConnectionStateProperty # type: ignore - from ._models import PrivateLinkServiceConnectionStatePropertyAutoGenerated # type: ignore from ._models import ProxyResource # type: ignore from ._models import RegionForOnlineOffline # type: ignore from ._models import Resource # type: ignore @@ -314,6 +328,7 @@ from ._models import VirtualNetworkRule # type: ignore from ._cosmos_db_management_client_enums import ( + BackupPolicyType, CompositePathSortOrder, ConflictResolutionMode, ConnectorOffer, @@ -323,10 +338,12 @@ IndexKind, IndexingMode, KeyKind, + NetworkAclBypass, NotebookWorkspaceName, PartitionKind, PrimaryAggregationType, PublicNetworkAccess, + ResourceIdentityType, ServerVersion, SpatialType, TriggerOperation, @@ -341,6 +358,7 @@ 'AutoUpgradePolicyResource', 'AutoscaleSettings', 'AutoscaleSettingsResource', + 'BackupPolicy', 'Capability', 'CassandraKeyspaceCreateUpdateParameters', 'CassandraKeyspaceGetPropertiesOptions', @@ -358,10 +376,12 @@ 'CassandraTableResource', 'ClusterKey', 'Column', + 'Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties', 'CompositePath', 'ConflictResolutionPolicy', 'ConsistencyPolicy', 'ContainerPartitionKey', + 'ContinuousModeBackupPolicy', 'CorsPolicy', 'CreateUpdateOptions', 'DatabaseAccountConnectionString', @@ -373,7 +393,10 @@ 'DatabaseAccountRegenerateKeyParameters', 'DatabaseAccountUpdateParameters', 'DatabaseAccountsListResult', + 'ErrorAdditionalInfo', 'ErrorResponse', + 'ErrorResponseAutoGenerated', + 'ErrorResponseUpdatedFormat', 'ExcludedPath', 'ExtendedResourceProperties', 'FailoverPolicies', @@ -395,6 +418,7 @@ 'IndexingPolicy', 'IpAddressOrRange', 'Location', + 'ManagedServiceIdentity', 'Metric', 'MetricAvailability', 'MetricDefinition', @@ -432,14 +456,14 @@ 'PercentileMetric', 'PercentileMetricListResult', 'PercentileMetricValue', + 'PeriodicModeBackupPolicy', + 'PeriodicModeProperties', 'PrivateEndpointConnection', - 'PrivateEndpointConnectionAutoGenerated', 'PrivateEndpointConnectionListResult', 'PrivateEndpointProperty', 'PrivateLinkResource', 'PrivateLinkResourceListResult', 'PrivateLinkServiceConnectionStateProperty', - 'PrivateLinkServiceConnectionStatePropertyAutoGenerated', 'ProxyResource', 'RegionForOnlineOffline', 'Resource', @@ -487,6 +511,7 @@ 'Usage', 'UsagesResult', 'VirtualNetworkRule', + 'BackupPolicyType', 'CompositePathSortOrder', 'ConflictResolutionMode', 'ConnectorOffer', @@ -496,10 +521,12 @@ 'IndexKind', 'IndexingMode', 'KeyKind', + 'NetworkAclBypass', 'NotebookWorkspaceName', 'PartitionKind', 'PrimaryAggregationType', 'PublicNetworkAccess', + 'ResourceIdentityType', 'ServerVersion', 'SpatialType', 'TriggerOperation', diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_management_client_enums.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_management_client_enums.py index 2aff24b8e8d1..f0b87b1d694d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_management_client_enums.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_management_client_enums.py @@ -26,12 +26,19 @@ def __getattr__(cls, name): raise AttributeError(name) +class BackupPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes the mode of backups. + """ + + PERIODIC = "Periodic" + CONTINUOUS = "Continuous" + class CompositePathSortOrder(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Sort order for composite paths. """ - ASCENDING = "Ascending" - DESCENDING = "Descending" + ASCENDING = "ascending" + DESCENDING = "descending" class ConflictResolutionMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Indicates the conflict resolution mode. @@ -79,9 +86,9 @@ class IndexingMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Indicates the indexing mode. """ - CONSISTENT = "Consistent" - LAZY = "Lazy" - NONE = "None" + CONSISTENT = "consistent" + LAZY = "lazy" + NONE = "none" class IndexKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of index. @@ -100,16 +107,25 @@ class KeyKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PRIMARY_READONLY = "primaryReadonly" SECONDARY_READONLY = "secondaryReadonly" +class NetworkAclBypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates what services are allowed to bypass firewall checks. + """ + + NONE = "None" + AZURE_SERVICES = "AzureServices" + class NotebookWorkspaceName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" class PartitionKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Indicates the kind of algorithm used for partitioning + """Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys + (upto three maximum) are supported for container create """ HASH = "Hash" RANGE = "Range" + MULTI_HASH = "MultiHash" class PrimaryAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The primary aggregation type of the metric. @@ -129,12 +145,24 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes + both an implicitly created identity and a set of user assigned identities. The type 'None' will + remove any identities from the service. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + NONE = "None" + class ServerVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Describes the ServerVersion of an a MongoDB account. """ THREE2 = "3.2" THREE6 = "3.6" + FOUR0 = "4.0" class SpatialType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Indicates the spatial type of index. 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 017a532c5d48..0be450aa474d 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 @@ -14,7 +14,7 @@ class ApiProperties(msrest.serialization.Model): """ApiProperties. :param server_version: Describes the ServerVersion of an a MongoDB account. Possible values - include: "3.2", "3.6". + include: "3.2", "3.6", "4.0". :type server_version: str or ~azure.mgmt.cosmosdb.models.ServerVersion """ @@ -189,6 +189,39 @@ def __init__( self.throughput_policy = kwargs.get('throughput_policy', None) +class BackupPolicy(msrest.serialization.Model): + """The object representing the policy for taking backups on an account. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContinuousModeBackupPolicy, PeriodicModeBackupPolicy. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Describes the mode of backups.Constant filled by server. Possible + values include: "Periodic", "Continuous". + :type type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Continuous': 'ContinuousModeBackupPolicy', 'Periodic': 'PeriodicModeBackupPolicy'} + } + + def __init__( + self, + **kwargs + ): + super(BackupPolicy, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + class Capability(msrest.serialization.Model): """Cosmos DB capability object. @@ -233,8 +266,8 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, str] :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -243,7 +276,6 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -262,7 +294,7 @@ def __init__( ): super(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class OptionsResource(msrest.serialization.Model): @@ -344,7 +376,7 @@ class ExtendedResourceProperties(msrest.serialization.Model): :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -358,7 +390,7 @@ class ExtendedResourceProperties(msrest.serialization.Model): _attribute_map = { 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -384,7 +416,7 @@ class CassandraKeyspaceGetPropertiesResource(ExtendedResourceProperties, Cassand :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -400,7 +432,7 @@ class CassandraKeyspaceGetPropertiesResource(ExtendedResourceProperties, Cassand _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -562,8 +594,8 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, str] :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -572,7 +604,6 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -591,7 +622,7 @@ def __init__( ): super(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class CassandraTableGetPropertiesOptions(OptionsResource): @@ -671,7 +702,7 @@ class CassandraTableGetPropertiesResource(ExtendedResourceProperties, CassandraT :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -690,7 +721,7 @@ class CassandraTableGetPropertiesResource(ExtendedResourceProperties, CassandraT 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'int'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -832,14 +863,44 @@ def __init__( self.type = kwargs.get('type', None) +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + class CompositePath(msrest.serialization.Model): """CompositePath. :param path: The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). :type path: str - :param order: Sort order for composite paths. Possible values include: "Ascending", - "Descending". + :param order: Sort order for composite paths. Possible values include: "ascending", + "descending". :type order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder """ @@ -931,23 +992,30 @@ def __init__( class ContainerPartitionKey(msrest.serialization.Model): """The configuration of the partition key to be used for partitioning data into multiple partitions. + Variables are only populated by the server, and will be ignored when sending a request. + :param paths: List of paths using which data within the container can be partitioned. :type paths: list[str] - :param kind: Indicates the kind of algorithm used for partitioning. Possible values include: - "Hash", "Range". Default value: "Hash". + :param kind: Indicates the kind of algorithm used for partitioning. For MultiHash, multiple + partition keys (upto three maximum) are supported for container create. Possible values + include: "Hash", "Range", "MultiHash". Default value: "Hash". :type kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind :param version: Indicates the version of the partition key definition. :type version: int + :ivar system_key: Indicates if the container is using a system generated partition key. + :vartype system_key: bool """ _validation = { 'version': {'maximum': 2, 'minimum': 1}, + 'system_key': {'readonly': True}, } _attribute_map = { 'paths': {'key': 'paths', 'type': '[str]'}, 'kind': {'key': 'kind', 'type': 'str'}, 'version': {'key': 'version', 'type': 'int'}, + 'system_key': {'key': 'systemKey', 'type': 'bool'}, } def __init__( @@ -958,6 +1026,33 @@ def __init__( self.paths = kwargs.get('paths', None) self.kind = kwargs.get('kind', "Hash") self.version = kwargs.get('version', None) + self.system_key = None + + +class ContinuousModeBackupPolicy(BackupPolicy): + """The object representing continuous mode backup policy. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Describes the mode of backups.Constant filled by server. Possible + values include: "Periodic", "Continuous". + :type type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ContinuousModeBackupPolicy, self).__init__(**kwargs) + self.type = 'Continuous' # type: str class CorsPolicy(msrest.serialization.Model): @@ -1085,6 +1180,8 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): :param kind: Indicates the type of database account. This can only be set at database account creation. Possible values include: "GlobalDocumentDB", "MongoDB", "Parse". :type kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind + :param identity: Identity for the resource. + :type identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :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 @@ -1129,8 +1226,16 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): :type api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties :param enable_analytical_storage: Flag to indicate whether to enable storage analytics. :type enable_analytical_storage: bool + :param backup_policy: The object representing the policy for taking backups on an account. + :type backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy :param cors: The CORS policy for the Cosmos DB database account. :type cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :param network_acl_bypass: Indicates what services are allowed to bypass firewall checks. + Possible values include: "None", "AzureServices". + :type network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :param network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :type network_acl_bypass_resource_ids: list[str] """ _validation = { @@ -1149,6 +1254,7 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, 'locations': {'key': 'properties.locations', 'type': '[Location]'}, 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, @@ -1166,7 +1272,10 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, + 'backup_policy': {'key': 'properties.backupPolicy', 'type': 'BackupPolicy'}, 'cors': {'key': 'properties.cors', 'type': '[CorsPolicy]'}, + 'network_acl_bypass': {'key': 'properties.networkAclBypass', 'type': 'str'}, + 'network_acl_bypass_resource_ids': {'key': 'properties.networkAclBypassResourceIds', 'type': '[str]'}, } database_account_offer_type = "Standard" @@ -1177,6 +1286,7 @@ def __init__( ): super(DatabaseAccountCreateUpdateParameters, self).__init__(**kwargs) self.kind = kwargs.get('kind', None) + self.identity = kwargs.get('identity', None) self.consistency_policy = kwargs.get('consistency_policy', None) self.locations = kwargs['locations'] self.ip_rules = kwargs.get('ip_rules', None) @@ -1193,7 +1303,10 @@ def __init__( self.enable_free_tier = kwargs.get('enable_free_tier', None) self.api_properties = kwargs.get('api_properties', None) self.enable_analytical_storage = kwargs.get('enable_analytical_storage', None) + self.backup_policy = kwargs.get('backup_policy', None) self.cors = kwargs.get('cors', None) + self.network_acl_bypass = kwargs.get('network_acl_bypass', None) + self.network_acl_bypass_resource_ids = kwargs.get('network_acl_bypass_resource_ids', None) class DatabaseAccountGetResults(ARMResourceProperties): @@ -1219,6 +1332,8 @@ class DatabaseAccountGetResults(ARMResourceProperties): :param kind: Indicates the type of database account. This can only be set at database account creation. Possible values include: "GlobalDocumentDB", "MongoDB", "Parse". :type kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind + :param identity: Identity for the resource. + :type identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar provisioning_state: The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for @@ -1284,8 +1399,16 @@ class DatabaseAccountGetResults(ARMResourceProperties): :type api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties :param enable_analytical_storage: Flag to indicate whether to enable storage analytics. :type enable_analytical_storage: bool + :param backup_policy: The object representing the policy for taking backups on an account. + :type backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy :param cors: The CORS policy for the Cosmos DB database account. :type cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :param network_acl_bypass: Indicates what services are allowed to bypass firewall checks. + Possible values include: "None", "AzureServices". + :type network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :param network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :type network_acl_bypass_resource_ids: list[str] """ _validation = { @@ -1310,6 +1433,7 @@ class DatabaseAccountGetResults(ARMResourceProperties): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, @@ -1333,7 +1457,10 @@ class DatabaseAccountGetResults(ARMResourceProperties): 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, + 'backup_policy': {'key': 'properties.backupPolicy', 'type': 'BackupPolicy'}, 'cors': {'key': 'properties.cors', 'type': '[CorsPolicy]'}, + 'network_acl_bypass': {'key': 'properties.networkAclBypass', 'type': 'str'}, + 'network_acl_bypass_resource_ids': {'key': 'properties.networkAclBypassResourceIds', 'type': '[str]'}, } database_account_offer_type = "Standard" @@ -1344,6 +1471,7 @@ def __init__( ): super(DatabaseAccountGetResults, self).__init__(**kwargs) self.kind = kwargs.get('kind', None) + self.identity = kwargs.get('identity', None) self.provisioning_state = None self.document_endpoint = None self.database_account_offer_type = None @@ -1367,7 +1495,10 @@ def __init__( self.enable_free_tier = kwargs.get('enable_free_tier', None) self.api_properties = kwargs.get('api_properties', None) self.enable_analytical_storage = kwargs.get('enable_analytical_storage', None) + self.backup_policy = kwargs.get('backup_policy', None) self.cors = kwargs.get('cors', None) + self.network_acl_bypass = kwargs.get('network_acl_bypass', None) + self.network_acl_bypass_resource_ids = kwargs.get('network_acl_bypass_resource_ids', None) class DatabaseAccountListConnectionStringsResult(msrest.serialization.Model): @@ -1523,6 +1654,8 @@ class DatabaseAccountUpdateParameters(msrest.serialization.Model): :type tags: dict[str, str] :param location: The location of the resource group to which the resource belongs. :type location: str + :param identity: Identity for the resource. + :type identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :param consistency_policy: The consistency policy for the Cosmos DB account. :type consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy :param locations: An array that contains the georeplication locations enabled for the Cosmos DB @@ -1564,8 +1697,16 @@ class DatabaseAccountUpdateParameters(msrest.serialization.Model): :type api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties :param enable_analytical_storage: Flag to indicate whether to enable storage analytics. :type enable_analytical_storage: bool + :param backup_policy: The object representing the policy for taking backups on an account. + :type backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy :param cors: The CORS policy for the Cosmos DB database account. :type cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :param network_acl_bypass: Indicates what services are allowed to bypass firewall checks. + Possible values include: "None", "AzureServices". + :type network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :param network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :type network_acl_bypass_resource_ids: list[str] """ _validation = { @@ -1575,6 +1716,7 @@ class DatabaseAccountUpdateParameters(msrest.serialization.Model): _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, 'locations': {'key': 'properties.locations', 'type': '[Location]'}, 'ip_rules': {'key': 'properties.ipRules', 'type': '[IpAddressOrRange]'}, @@ -1591,7 +1733,10 @@ class DatabaseAccountUpdateParameters(msrest.serialization.Model): 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, + 'backup_policy': {'key': 'properties.backupPolicy', 'type': 'BackupPolicy'}, 'cors': {'key': 'properties.cors', 'type': '[CorsPolicy]'}, + 'network_acl_bypass': {'key': 'properties.networkAclBypass', 'type': 'str'}, + 'network_acl_bypass_resource_ids': {'key': 'properties.networkAclBypassResourceIds', 'type': '[str]'}, } def __init__( @@ -1601,6 +1746,7 @@ def __init__( super(DatabaseAccountUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.location = kwargs.get('location', None) + self.identity = kwargs.get('identity', None) self.consistency_policy = kwargs.get('consistency_policy', None) self.locations = kwargs.get('locations', None) self.ip_rules = kwargs.get('ip_rules', None) @@ -1617,7 +1763,40 @@ def __init__( self.enable_free_tier = kwargs.get('enable_free_tier', None) self.api_properties = kwargs.get('api_properties', None) self.enable_analytical_storage = kwargs.get('enable_analytical_storage', None) + self.backup_policy = kwargs.get('backup_policy', None) self.cors = kwargs.get('cors', None) + self.network_acl_bypass = kwargs.get('network_acl_bypass', None) + self.network_acl_bypass_resource_ids = kwargs.get('network_acl_bypass_resource_ids', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None class ErrorResponse(msrest.serialization.Model): @@ -1643,6 +1822,71 @@ def __init__( self.message = kwargs.get('message', None) +class ErrorResponseAutoGenerated(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.cosmosdb.models.ErrorResponseAutoGenerated] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.cosmosdb.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponseAutoGenerated]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseAutoGenerated, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponseUpdatedFormat(msrest.serialization.Model): + """An error response from the service. + + :param error: Common error response for all Azure Resource Manager APIs to return error details + for failed operations. (This also follows the OData error response format.). + :type error: ~azure.mgmt.cosmosdb.models.ErrorResponseAutoGenerated + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseAutoGenerated'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseUpdatedFormat, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + class ExcludedPath(msrest.serialization.Model): """ExcludedPath. @@ -1750,8 +1994,8 @@ class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, 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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -1760,7 +2004,6 @@ class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -1779,7 +2022,7 @@ def __init__( ): super(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class GremlinDatabaseGetPropertiesOptions(OptionsResource): @@ -1841,7 +2084,7 @@ class GremlinDatabaseGetPropertiesResource(ExtendedResourceProperties, GremlinDa :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -1857,7 +2100,7 @@ class GremlinDatabaseGetPropertiesResource(ExtendedResourceProperties, GremlinDa _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -1973,8 +2216,8 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -1983,7 +2226,6 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -2002,7 +2244,7 @@ def __init__( ): super(GremlinGraphCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class GremlinGraphGetPropertiesOptions(OptionsResource): @@ -2100,7 +2342,7 @@ class GremlinGraphGetPropertiesResource(ExtendedResourceProperties, GremlinGraph :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -2121,7 +2363,7 @@ class GremlinGraphGetPropertiesResource(ExtendedResourceProperties, GremlinGraph 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -2277,8 +2519,8 @@ class IndexingPolicy(msrest.serialization.Model): :param automatic: Indicates if the indexing policy is automatic. :type automatic: bool - :param indexing_mode: Indicates the indexing mode. Possible values include: "Consistent", - "Lazy", "None". Default value: "Consistent". + :param indexing_mode: Indicates the indexing mode. Possible values include: "consistent", + "lazy", "none". Default value: "consistent". :type indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode :param included_paths: List of paths to include in the indexing. :type included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] @@ -2305,7 +2547,7 @@ def __init__( ): super(IndexingPolicy, self).__init__(**kwargs) self.automatic = kwargs.get('automatic', None) - self.indexing_mode = kwargs.get('indexing_mode', "Consistent") + self.indexing_mode = kwargs.get('indexing_mode', "consistent") self.included_paths = kwargs.get('included_paths', None) self.excluded_paths = kwargs.get('excluded_paths', None) self.composite_indexes = kwargs.get('composite_indexes', None) @@ -2395,6 +2637,52 @@ def __init__( self.is_zone_redundant = kwargs.get('is_zone_redundant', None) +class ManagedServiceIdentity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of the system assigned identity. This property will only + be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. The type + 'None' will remove any identities from the service. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned", "None". + :type type: str or ~azure.mgmt.cosmosdb.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with resource. The user + identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.cosmosdb.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + class Metric(msrest.serialization.Model): """Metric data. @@ -2677,8 +2965,8 @@ class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, str] :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -2687,7 +2975,6 @@ class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -2706,7 +2993,7 @@ def __init__( ): super(MongoDBCollectionCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class MongoDBCollectionGetPropertiesOptions(OptionsResource): @@ -2786,7 +3073,7 @@ class MongoDBCollectionGetPropertiesResource(ExtendedResourceProperties, MongoDB :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -2805,7 +3092,7 @@ class MongoDBCollectionGetPropertiesResource(ExtendedResourceProperties, MongoDB 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'int'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -2924,8 +3211,8 @@ class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, 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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -2934,7 +3221,6 @@ class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -2953,7 +3239,7 @@ def __init__( ): super(MongoDBDatabaseCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class MongoDBDatabaseGetPropertiesOptions(OptionsResource): @@ -3015,7 +3301,7 @@ class MongoDBDatabaseGetPropertiesResource(ExtendedResourceProperties, MongoDBDa :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -3031,7 +3317,7 @@ class MongoDBDatabaseGetPropertiesResource(ExtendedResourceProperties, MongoDBDa _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -3749,62 +4035,79 @@ def __init__( self.p99 = None -class Resource(msrest.serialization.Model): - """Resource. +class PeriodicModeBackupPolicy(BackupPolicy): + """The object representing periodic mode backup policy. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str + :param type: Required. Describes the mode of backups.Constant filled by server. Possible + values include: "Periodic", "Continuous". + :type type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType + :param periodic_mode_properties: Configuration values for periodic mode backup. + :type periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'type': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'periodic_mode_properties': {'key': 'periodicModeProperties', 'type': 'PeriodicModeProperties'}, } def __init__( self, **kwargs ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + super(PeriodicModeBackupPolicy, self).__init__(**kwargs) + self.type = 'Periodic' # type: str + self.periodic_mode_properties = kwargs.get('periodic_mode_properties', None) -class PrivateEndpointConnection(Resource): - """A private endpoint connection. +class PeriodicModeProperties(msrest.serialization.Model): + """Configuration values for periodic mode backup. + + :param backup_interval_in_minutes: An integer representing the interval in minutes between two + backups. + :type backup_interval_in_minutes: int + :param backup_retention_interval_in_hours: An integer representing the time (in hours) that + each backup is retained. + :type backup_retention_interval_in_hours: int + """ + + _validation = { + 'backup_interval_in_minutes': {'minimum': 0}, + 'backup_retention_interval_in_hours': {'minimum': 0}, + } + + _attribute_map = { + 'backup_interval_in_minutes': {'key': 'backupIntervalInMinutes', 'type': 'int'}, + 'backup_retention_interval_in_hours': {'key': 'backupRetentionIntervalInHours', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(PeriodicModeProperties, self).__init__(**kwargs) + self.backup_interval_in_minutes = kwargs.get('backup_interval_in_minutes', None) + self.backup_retention_interval_in_hours = kwargs.get('backup_retention_interval_in_hours', None) + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: Private endpoint which the connection belongs to. - :type private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty - :param private_link_service_connection_state: Connection State of the Private Endpoint - Connection. - :type private_link_service_connection_state: - ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty """ _validation = { @@ -3817,38 +4120,37 @@ class PrivateEndpointConnection(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, } def __init__( self, **kwargs ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class PrivateEndpointConnectionAutoGenerated(Resource): +class PrivateEndpointConnection(Resource): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param private_endpoint: Private endpoint which the connection belongs to. :type private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty :param private_link_service_connection_state: Connection State of the Private Endpoint Connection. :type private_link_service_connection_state: - ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStatePropertyAutoGenerated + ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty :param group_id: Group id of the private endpoint. :type group_id: str :param provisioning_state: Provisioning state of the private endpoint. @@ -3866,7 +4168,7 @@ class PrivateEndpointConnectionAutoGenerated(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStatePropertyAutoGenerated'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, 'group_id': {'key': 'properties.groupId', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -3875,7 +4177,7 @@ def __init__( self, **kwargs ): - super(PrivateEndpointConnectionAutoGenerated, self).__init__(**kwargs) + super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) self.group_id = kwargs.get('group_id', None) @@ -3886,11 +4188,11 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """A list of private endpoint connections. :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionAutoGenerated] + :type value: list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnectionAutoGenerated]'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, } def __init__( @@ -3991,36 +4293,6 @@ class PrivateLinkServiceConnectionStateProperty(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param status: The private link service connection status. - :type status: str - :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ - disconnect). - :vartype actions_required: str - """ - - _validation = { - 'actions_required': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.actions_required = None - - -class PrivateLinkServiceConnectionStatePropertyAutoGenerated(msrest.serialization.Model): - """Connection State of the Private Endpoint Connection. - - Variables are only populated by the server, and will be ignored when sending a request. - :param status: The private link service connection status. :type status: str :param description: The private link service connection description. @@ -4044,24 +4316,24 @@ def __init__( self, **kwargs ): - super(PrivateLinkServiceConnectionStatePropertyAutoGenerated, self).__init__(**kwargs) + super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) self.actions_required = None class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -4157,8 +4429,8 @@ class SqlContainerCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -4167,7 +4439,6 @@ class SqlContainerCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -4186,7 +4457,7 @@ def __init__( ): super(SqlContainerCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class SqlContainerGetPropertiesOptions(OptionsResource): @@ -4290,7 +4561,7 @@ class SqlContainerGetPropertiesResource(ExtendedResourceProperties, SqlContainer :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -4312,7 +4583,7 @@ class SqlContainerGetPropertiesResource(ExtendedResourceProperties, SqlContainer 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'long'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -4434,8 +4705,8 @@ class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -4444,7 +4715,6 @@ class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -4463,7 +4733,7 @@ def __init__( ): super(SqlDatabaseCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class SqlDatabaseGetPropertiesOptions(OptionsResource): @@ -4523,7 +4793,7 @@ class SqlDatabaseGetPropertiesResource(SqlDatabaseResource, ExtendedResourceProp :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -4546,7 +4816,7 @@ class SqlDatabaseGetPropertiesResource(SqlDatabaseResource, ExtendedResourceProp _attribute_map = { 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'colls': {'key': '_colls', 'type': 'str'}, @@ -4669,8 +4939,8 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -4679,7 +4949,6 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -4698,7 +4967,7 @@ def __init__( ): super(SqlStoredProcedureCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class SqlStoredProcedureResource(msrest.serialization.Model): @@ -4744,7 +5013,7 @@ class SqlStoredProcedureGetPropertiesResource(ExtendedResourceProperties, SqlSto :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -4761,7 +5030,7 @@ class SqlStoredProcedureGetPropertiesResource(ExtendedResourceProperties, SqlSto 'id': {'key': 'id', 'type': 'str'}, 'body': {'key': 'body', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -4873,8 +5142,8 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -4883,7 +5152,6 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -4902,7 +5170,7 @@ def __init__( ): super(SqlTriggerCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class SqlTriggerResource(msrest.serialization.Model): @@ -4962,7 +5230,7 @@ class SqlTriggerGetPropertiesResource(ExtendedResourceProperties, SqlTriggerReso :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -4981,7 +5249,7 @@ class SqlTriggerGetPropertiesResource(ExtendedResourceProperties, SqlTriggerReso 'trigger_type': {'key': 'triggerType', 'type': 'str'}, 'trigger_operation': {'key': 'triggerOperation', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -5095,8 +5363,8 @@ class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -5105,7 +5373,6 @@ class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -5124,7 +5391,7 @@ def __init__( ): super(SqlUserDefinedFunctionCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class SqlUserDefinedFunctionResource(msrest.serialization.Model): @@ -5170,7 +5437,7 @@ class SqlUserDefinedFunctionGetPropertiesResource(ExtendedResourceProperties, Sq :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -5187,7 +5454,7 @@ class SqlUserDefinedFunctionGetPropertiesResource(ExtendedResourceProperties, Sq 'id': {'key': 'id', 'type': 'str'}, 'body': {'key': 'body', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -5299,8 +5566,8 @@ class TableCreateUpdateParameters(ARMResourceProperties): :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 the request. This - corresponds to the headers sent with the request. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -5309,7 +5576,6 @@ class TableCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -5328,7 +5594,7 @@ def __init__( ): super(TableCreateUpdateParameters, self).__init__(**kwargs) self.resource = kwargs['resource'] - self.options = kwargs['options'] + self.options = kwargs.get('options', None) class TableGetPropertiesOptions(OptionsResource): @@ -5390,7 +5656,7 @@ class TableGetPropertiesResource(ExtendedResourceProperties, TableResource): :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -5406,7 +5672,7 @@ class TableGetPropertiesResource(ExtendedResourceProperties, TableResource): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -5580,7 +5846,7 @@ class ThroughputSettingsGetPropertiesResource(ExtendedResourceProperties, Throug :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -5600,7 +5866,7 @@ class ThroughputSettingsGetPropertiesResource(ExtendedResourceProperties, Throug 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } 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 328ad248ecba..71de6e16af18 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 @@ -18,7 +18,7 @@ class ApiProperties(msrest.serialization.Model): """ApiProperties. :param server_version: Describes the ServerVersion of an a MongoDB account. Possible values - include: "3.2", "3.6". + include: "3.2", "3.6", "4.0". :type server_version: str or ~azure.mgmt.cosmosdb.models.ServerVersion """ @@ -205,6 +205,39 @@ def __init__( self.throughput_policy = throughput_policy +class BackupPolicy(msrest.serialization.Model): + """The object representing the policy for taking backups on an account. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContinuousModeBackupPolicy, PeriodicModeBackupPolicy. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Describes the mode of backups.Constant filled by server. Possible + values include: "Periodic", "Continuous". + :type type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Continuous': 'ContinuousModeBackupPolicy', 'Periodic': 'PeriodicModeBackupPolicy'} + } + + def __init__( + self, + **kwargs + ): + super(BackupPolicy, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + class Capability(msrest.serialization.Model): """Cosmos DB capability object. @@ -251,8 +284,8 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, str] :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -261,7 +294,6 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -278,9 +310,9 @@ def __init__( self, *, resource: "CassandraKeyspaceResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(CassandraKeyspaceCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -375,7 +407,7 @@ class ExtendedResourceProperties(msrest.serialization.Model): :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -389,7 +421,7 @@ class ExtendedResourceProperties(msrest.serialization.Model): _attribute_map = { 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -415,7 +447,7 @@ class CassandraKeyspaceGetPropertiesResource(ExtendedResourceProperties, Cassand :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -431,7 +463,7 @@ class CassandraKeyspaceGetPropertiesResource(ExtendedResourceProperties, Cassand _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -605,8 +637,8 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, str] :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -615,7 +647,6 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -632,9 +663,9 @@ def __init__( self, *, resource: "CassandraTableResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(CassandraTableCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -727,7 +758,7 @@ class CassandraTableGetPropertiesResource(ExtendedResourceProperties, CassandraT :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -746,7 +777,7 @@ class CassandraTableGetPropertiesResource(ExtendedResourceProperties, CassandraT 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'int'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -903,14 +934,44 @@ def __init__( self.type = type +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + class CompositePath(msrest.serialization.Model): """CompositePath. :param path: The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). :type path: str - :param order: Sort order for composite paths. Possible values include: "Ascending", - "Descending". + :param order: Sort order for composite paths. Possible values include: "ascending", + "descending". :type order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder """ @@ -1013,23 +1074,30 @@ def __init__( class ContainerPartitionKey(msrest.serialization.Model): """The configuration of the partition key to be used for partitioning data into multiple partitions. + Variables are only populated by the server, and will be ignored when sending a request. + :param paths: List of paths using which data within the container can be partitioned. :type paths: list[str] - :param kind: Indicates the kind of algorithm used for partitioning. Possible values include: - "Hash", "Range". Default value: "Hash". + :param kind: Indicates the kind of algorithm used for partitioning. For MultiHash, multiple + partition keys (upto three maximum) are supported for container create. Possible values + include: "Hash", "Range", "MultiHash". Default value: "Hash". :type kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind :param version: Indicates the version of the partition key definition. :type version: int + :ivar system_key: Indicates if the container is using a system generated partition key. + :vartype system_key: bool """ _validation = { 'version': {'maximum': 2, 'minimum': 1}, + 'system_key': {'readonly': True}, } _attribute_map = { 'paths': {'key': 'paths', 'type': '[str]'}, 'kind': {'key': 'kind', 'type': 'str'}, 'version': {'key': 'version', 'type': 'int'}, + 'system_key': {'key': 'systemKey', 'type': 'bool'}, } def __init__( @@ -1044,6 +1112,33 @@ def __init__( self.paths = paths self.kind = kind self.version = version + self.system_key = None + + +class ContinuousModeBackupPolicy(BackupPolicy): + """The object representing continuous mode backup policy. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Describes the mode of backups.Constant filled by server. Possible + values include: "Periodic", "Continuous". + :type type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ContinuousModeBackupPolicy, self).__init__(**kwargs) + self.type = 'Continuous' # type: str class CorsPolicy(msrest.serialization.Model): @@ -1180,6 +1275,8 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): :param kind: Indicates the type of database account. This can only be set at database account creation. Possible values include: "GlobalDocumentDB", "MongoDB", "Parse". :type kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind + :param identity: Identity for the resource. + :type identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :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 @@ -1224,8 +1321,16 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): :type api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties :param enable_analytical_storage: Flag to indicate whether to enable storage analytics. :type enable_analytical_storage: bool + :param backup_policy: The object representing the policy for taking backups on an account. + :type backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy :param cors: The CORS policy for the Cosmos DB database account. :type cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :param network_acl_bypass: Indicates what services are allowed to bypass firewall checks. + Possible values include: "None", "AzureServices". + :type network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :param network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :type network_acl_bypass_resource_ids: list[str] """ _validation = { @@ -1244,6 +1349,7 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, 'locations': {'key': 'properties.locations', 'type': '[Location]'}, 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, @@ -1261,7 +1367,10 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, + 'backup_policy': {'key': 'properties.backupPolicy', 'type': 'BackupPolicy'}, 'cors': {'key': 'properties.cors', 'type': '[CorsPolicy]'}, + 'network_acl_bypass': {'key': 'properties.networkAclBypass', 'type': 'str'}, + 'network_acl_bypass_resource_ids': {'key': 'properties.networkAclBypassResourceIds', 'type': '[str]'}, } database_account_offer_type = "Standard" @@ -1273,6 +1382,7 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, kind: Optional[Union[str, "DatabaseAccountKind"]] = None, + identity: Optional["ManagedServiceIdentity"] = None, consistency_policy: Optional["ConsistencyPolicy"] = None, ip_rules: Optional[List["IpAddressOrRange"]] = None, is_virtual_network_filter_enabled: Optional[bool] = None, @@ -1287,11 +1397,15 @@ def __init__( enable_free_tier: Optional[bool] = None, api_properties: Optional["ApiProperties"] = None, enable_analytical_storage: Optional[bool] = None, + backup_policy: Optional["BackupPolicy"] = None, cors: Optional[List["CorsPolicy"]] = None, + network_acl_bypass: Optional[Union[str, "NetworkAclBypass"]] = None, + network_acl_bypass_resource_ids: Optional[List[str]] = None, **kwargs ): super(DatabaseAccountCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.kind = kind + self.identity = identity self.consistency_policy = consistency_policy self.locations = locations self.ip_rules = ip_rules @@ -1308,7 +1422,10 @@ def __init__( self.enable_free_tier = enable_free_tier self.api_properties = api_properties self.enable_analytical_storage = enable_analytical_storage + self.backup_policy = backup_policy self.cors = cors + self.network_acl_bypass = network_acl_bypass + self.network_acl_bypass_resource_ids = network_acl_bypass_resource_ids class DatabaseAccountGetResults(ARMResourceProperties): @@ -1334,6 +1451,8 @@ class DatabaseAccountGetResults(ARMResourceProperties): :param kind: Indicates the type of database account. This can only be set at database account creation. Possible values include: "GlobalDocumentDB", "MongoDB", "Parse". :type kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind + :param identity: Identity for the resource. + :type identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar provisioning_state: The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for @@ -1399,8 +1518,16 @@ class DatabaseAccountGetResults(ARMResourceProperties): :type api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties :param enable_analytical_storage: Flag to indicate whether to enable storage analytics. :type enable_analytical_storage: bool + :param backup_policy: The object representing the policy for taking backups on an account. + :type backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy :param cors: The CORS policy for the Cosmos DB database account. :type cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :param network_acl_bypass: Indicates what services are allowed to bypass firewall checks. + Possible values include: "None", "AzureServices". + :type network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :param network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :type network_acl_bypass_resource_ids: list[str] """ _validation = { @@ -1425,6 +1552,7 @@ class DatabaseAccountGetResults(ARMResourceProperties): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, @@ -1448,7 +1576,10 @@ class DatabaseAccountGetResults(ARMResourceProperties): 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, + 'backup_policy': {'key': 'properties.backupPolicy', 'type': 'BackupPolicy'}, 'cors': {'key': 'properties.cors', 'type': '[CorsPolicy]'}, + 'network_acl_bypass': {'key': 'properties.networkAclBypass', 'type': 'str'}, + 'network_acl_bypass_resource_ids': {'key': 'properties.networkAclBypassResourceIds', 'type': '[str]'}, } database_account_offer_type = "Standard" @@ -1459,6 +1590,7 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, kind: Optional[Union[str, "DatabaseAccountKind"]] = None, + identity: Optional["ManagedServiceIdentity"] = None, ip_rules: Optional[List["IpAddressOrRange"]] = None, is_virtual_network_filter_enabled: Optional[bool] = None, enable_automatic_failover: Optional[bool] = None, @@ -1473,11 +1605,15 @@ def __init__( enable_free_tier: Optional[bool] = None, api_properties: Optional["ApiProperties"] = None, enable_analytical_storage: Optional[bool] = None, + backup_policy: Optional["BackupPolicy"] = None, cors: Optional[List["CorsPolicy"]] = None, + network_acl_bypass: Optional[Union[str, "NetworkAclBypass"]] = None, + network_acl_bypass_resource_ids: Optional[List[str]] = None, **kwargs ): super(DatabaseAccountGetResults, self).__init__(location=location, tags=tags, **kwargs) self.kind = kind + self.identity = identity self.provisioning_state = None self.document_endpoint = None self.database_account_offer_type = None @@ -1501,7 +1637,10 @@ def __init__( self.enable_free_tier = enable_free_tier self.api_properties = api_properties self.enable_analytical_storage = enable_analytical_storage + self.backup_policy = backup_policy self.cors = cors + self.network_acl_bypass = network_acl_bypass + self.network_acl_bypass_resource_ids = network_acl_bypass_resource_ids class DatabaseAccountListConnectionStringsResult(msrest.serialization.Model): @@ -1661,6 +1800,8 @@ class DatabaseAccountUpdateParameters(msrest.serialization.Model): :type tags: dict[str, str] :param location: The location of the resource group to which the resource belongs. :type location: str + :param identity: Identity for the resource. + :type identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :param consistency_policy: The consistency policy for the Cosmos DB account. :type consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy :param locations: An array that contains the georeplication locations enabled for the Cosmos DB @@ -1702,8 +1843,16 @@ class DatabaseAccountUpdateParameters(msrest.serialization.Model): :type api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties :param enable_analytical_storage: Flag to indicate whether to enable storage analytics. :type enable_analytical_storage: bool + :param backup_policy: The object representing the policy for taking backups on an account. + :type backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy :param cors: The CORS policy for the Cosmos DB database account. :type cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :param network_acl_bypass: Indicates what services are allowed to bypass firewall checks. + Possible values include: "None", "AzureServices". + :type network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :param network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :type network_acl_bypass_resource_ids: list[str] """ _validation = { @@ -1713,6 +1862,7 @@ class DatabaseAccountUpdateParameters(msrest.serialization.Model): _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, 'locations': {'key': 'properties.locations', 'type': '[Location]'}, 'ip_rules': {'key': 'properties.ipRules', 'type': '[IpAddressOrRange]'}, @@ -1729,7 +1879,10 @@ class DatabaseAccountUpdateParameters(msrest.serialization.Model): 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, + 'backup_policy': {'key': 'properties.backupPolicy', 'type': 'BackupPolicy'}, 'cors': {'key': 'properties.cors', 'type': '[CorsPolicy]'}, + 'network_acl_bypass': {'key': 'properties.networkAclBypass', 'type': 'str'}, + 'network_acl_bypass_resource_ids': {'key': 'properties.networkAclBypassResourceIds', 'type': '[str]'}, } def __init__( @@ -1737,6 +1890,7 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, + identity: Optional["ManagedServiceIdentity"] = None, consistency_policy: Optional["ConsistencyPolicy"] = None, locations: Optional[List["Location"]] = None, ip_rules: Optional[List["IpAddressOrRange"]] = None, @@ -1752,12 +1906,16 @@ def __init__( enable_free_tier: Optional[bool] = None, api_properties: Optional["ApiProperties"] = None, enable_analytical_storage: Optional[bool] = None, + backup_policy: Optional["BackupPolicy"] = None, cors: Optional[List["CorsPolicy"]] = None, + network_acl_bypass: Optional[Union[str, "NetworkAclBypass"]] = None, + network_acl_bypass_resource_ids: Optional[List[str]] = None, **kwargs ): super(DatabaseAccountUpdateParameters, self).__init__(**kwargs) self.tags = tags self.location = location + self.identity = identity self.consistency_policy = consistency_policy self.locations = locations self.ip_rules = ip_rules @@ -1774,7 +1932,40 @@ def __init__( self.enable_free_tier = enable_free_tier self.api_properties = api_properties self.enable_analytical_storage = enable_analytical_storage + self.backup_policy = backup_policy self.cors = cors + self.network_acl_bypass = network_acl_bypass + self.network_acl_bypass_resource_ids = network_acl_bypass_resource_ids + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None class ErrorResponse(msrest.serialization.Model): @@ -1803,6 +1994,73 @@ def __init__( self.message = message +class ErrorResponseAutoGenerated(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.cosmosdb.models.ErrorResponseAutoGenerated] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.cosmosdb.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponseAutoGenerated]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseAutoGenerated, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponseUpdatedFormat(msrest.serialization.Model): + """An error response from the service. + + :param error: Common error response for all Azure Resource Manager APIs to return error details + for failed operations. (This also follows the OData error response format.). + :type error: ~azure.mgmt.cosmosdb.models.ErrorResponseAutoGenerated + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseAutoGenerated'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponseAutoGenerated"] = None, + **kwargs + ): + super(ErrorResponseUpdatedFormat, self).__init__(**kwargs) + self.error = error + + class ExcludedPath(msrest.serialization.Model): """ExcludedPath. @@ -1917,8 +2175,8 @@ class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, 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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -1927,7 +2185,6 @@ class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -1944,9 +2201,9 @@ def __init__( self, *, resource: "GremlinDatabaseResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(GremlinDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -2018,7 +2275,7 @@ class GremlinDatabaseGetPropertiesResource(ExtendedResourceProperties, GremlinDa :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -2034,7 +2291,7 @@ class GremlinDatabaseGetPropertiesResource(ExtendedResourceProperties, GremlinDa _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -2156,8 +2413,8 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -2166,7 +2423,6 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -2183,9 +2439,9 @@ def __init__( self, *, resource: "GremlinGraphResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(GremlinGraphCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -2298,7 +2554,7 @@ class GremlinGraphGetPropertiesResource(ExtendedResourceProperties, GremlinGraph :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -2319,7 +2575,7 @@ class GremlinGraphGetPropertiesResource(ExtendedResourceProperties, GremlinGraph 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -2493,8 +2749,8 @@ class IndexingPolicy(msrest.serialization.Model): :param automatic: Indicates if the indexing policy is automatic. :type automatic: bool - :param indexing_mode: Indicates the indexing mode. Possible values include: "Consistent", - "Lazy", "None". Default value: "Consistent". + :param indexing_mode: Indicates the indexing mode. Possible values include: "consistent", + "lazy", "none". Default value: "consistent". :type indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode :param included_paths: List of paths to include in the indexing. :type included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] @@ -2519,7 +2775,7 @@ def __init__( self, *, automatic: Optional[bool] = None, - indexing_mode: Optional[Union[str, "IndexingMode"]] = "Consistent", + indexing_mode: Optional[Union[str, "IndexingMode"]] = "consistent", included_paths: Optional[List["IncludedPath"]] = None, excluded_paths: Optional[List["ExcludedPath"]] = None, composite_indexes: Optional[List[List["CompositePath"]]] = None, @@ -2624,6 +2880,55 @@ def __init__( self.is_zone_redundant = is_zone_redundant +class ManagedServiceIdentity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of the system assigned identity. This property will only + be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. The type + 'None' will remove any identities from the service. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned", "None". + :type type: str or ~azure.mgmt.cosmosdb.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with resource. The user + identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.cosmosdb.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + class Metric(msrest.serialization.Model): """Metric data. @@ -2906,8 +3211,8 @@ class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, str] :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -2916,7 +3221,6 @@ class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -2933,9 +3237,9 @@ def __init__( self, *, resource: "MongoDBCollectionResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(MongoDBCollectionCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -3028,7 +3332,7 @@ class MongoDBCollectionGetPropertiesResource(ExtendedResourceProperties, MongoDB :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -3047,7 +3351,7 @@ class MongoDBCollectionGetPropertiesResource(ExtendedResourceProperties, MongoDB 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'int'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -3175,8 +3479,8 @@ class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): :type tags: dict[str, 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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -3185,7 +3489,6 @@ class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -3202,9 +3505,9 @@ def __init__( self, *, resource: "MongoDBDatabaseResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(MongoDBDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -3276,7 +3579,7 @@ class MongoDBDatabaseGetPropertiesResource(ExtendedResourceProperties, MongoDBDa :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -3292,7 +3595,7 @@ class MongoDBDatabaseGetPropertiesResource(ExtendedResourceProperties, MongoDBDa _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -4037,62 +4340,84 @@ def __init__( self.p99 = None -class Resource(msrest.serialization.Model): - """Resource. +class PeriodicModeBackupPolicy(BackupPolicy): + """The object representing periodic mode backup policy. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str + :param type: Required. Describes the mode of backups.Constant filled by server. Possible + values include: "Periodic", "Continuous". + :type type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType + :param periodic_mode_properties: Configuration values for periodic mode backup. + :type periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'type': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'periodic_mode_properties': {'key': 'periodicModeProperties', 'type': 'PeriodicModeProperties'}, } def __init__( self, + *, + periodic_mode_properties: Optional["PeriodicModeProperties"] = None, **kwargs ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + super(PeriodicModeBackupPolicy, self).__init__(**kwargs) + self.type = 'Periodic' # type: str + self.periodic_mode_properties = periodic_mode_properties -class PrivateEndpointConnection(Resource): - """A private endpoint connection. +class PeriodicModeProperties(msrest.serialization.Model): + """Configuration values for periodic mode backup. + + :param backup_interval_in_minutes: An integer representing the interval in minutes between two + backups. + :type backup_interval_in_minutes: int + :param backup_retention_interval_in_hours: An integer representing the time (in hours) that + each backup is retained. + :type backup_retention_interval_in_hours: int + """ + + _validation = { + 'backup_interval_in_minutes': {'minimum': 0}, + 'backup_retention_interval_in_hours': {'minimum': 0}, + } + + _attribute_map = { + 'backup_interval_in_minutes': {'key': 'backupIntervalInMinutes', 'type': 'int'}, + 'backup_retention_interval_in_hours': {'key': 'backupRetentionIntervalInHours', 'type': 'int'}, + } + + def __init__( + self, + *, + backup_interval_in_minutes: Optional[int] = None, + backup_retention_interval_in_hours: Optional[int] = None, + **kwargs + ): + super(PeriodicModeProperties, self).__init__(**kwargs) + self.backup_interval_in_minutes = backup_interval_in_minutes + self.backup_retention_interval_in_hours = backup_retention_interval_in_hours + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: Private endpoint which the connection belongs to. - :type private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty - :param private_link_service_connection_state: Connection State of the Private Endpoint - Connection. - :type private_link_service_connection_state: - ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty """ _validation = { @@ -4105,41 +4430,37 @@ class PrivateEndpointConnection(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, } def __init__( self, - *, - private_endpoint: Optional["PrivateEndpointProperty"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionStateProperty"] = None, **kwargs ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class PrivateEndpointConnectionAutoGenerated(Resource): +class PrivateEndpointConnection(Resource): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param private_endpoint: Private endpoint which the connection belongs to. :type private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty :param private_link_service_connection_state: Connection State of the Private Endpoint Connection. :type private_link_service_connection_state: - ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStatePropertyAutoGenerated + ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty :param group_id: Group id of the private endpoint. :type group_id: str :param provisioning_state: Provisioning state of the private endpoint. @@ -4157,7 +4478,7 @@ class PrivateEndpointConnectionAutoGenerated(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStatePropertyAutoGenerated'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, 'group_id': {'key': 'properties.groupId', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -4166,12 +4487,12 @@ def __init__( self, *, private_endpoint: Optional["PrivateEndpointProperty"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionStatePropertyAutoGenerated"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionStateProperty"] = None, group_id: Optional[str] = None, provisioning_state: Optional[str] = None, **kwargs ): - super(PrivateEndpointConnectionAutoGenerated, self).__init__(**kwargs) + super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.group_id = group_id @@ -4182,17 +4503,17 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """A list of private endpoint connections. :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionAutoGenerated] + :type value: list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnectionAutoGenerated]'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, } def __init__( self, *, - value: Optional[List["PrivateEndpointConnectionAutoGenerated"]] = None, + value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) @@ -4293,38 +4614,6 @@ class PrivateLinkServiceConnectionStateProperty(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param status: The private link service connection status. - :type status: str - :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ - disconnect). - :vartype actions_required: str - """ - - _validation = { - 'actions_required': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - *, - status: Optional[str] = None, - **kwargs - ): - super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) - self.status = status - self.actions_required = None - - -class PrivateLinkServiceConnectionStatePropertyAutoGenerated(msrest.serialization.Model): - """Connection State of the Private Endpoint Connection. - - Variables are only populated by the server, and will be ignored when sending a request. - :param status: The private link service connection status. :type status: str :param description: The private link service connection description. @@ -4351,24 +4640,24 @@ def __init__( description: Optional[str] = None, **kwargs ): - super(PrivateLinkServiceConnectionStatePropertyAutoGenerated, self).__init__(**kwargs) + super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) self.status = status self.description = description self.actions_required = None class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -4469,8 +4758,8 @@ class SqlContainerCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -4479,7 +4768,6 @@ class SqlContainerCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -4496,9 +4784,9 @@ def __init__( self, *, resource: "SqlContainerResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(SqlContainerCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -4618,7 +4906,7 @@ class SqlContainerGetPropertiesResource(ExtendedResourceProperties, SqlContainer :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -4640,7 +4928,7 @@ class SqlContainerGetPropertiesResource(ExtendedResourceProperties, SqlContainer 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'long'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -4774,8 +5062,8 @@ class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -4784,7 +5072,6 @@ class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -4801,9 +5088,9 @@ def __init__( self, *, resource: "SqlDatabaseResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(SqlDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -4873,7 +5160,7 @@ class SqlDatabaseGetPropertiesResource(SqlDatabaseResource, ExtendedResourceProp :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -4896,7 +5183,7 @@ class SqlDatabaseGetPropertiesResource(SqlDatabaseResource, ExtendedResourceProp _attribute_map = { 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'colls': {'key': '_colls', 'type': 'str'}, @@ -5027,8 +5314,8 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -5037,7 +5324,6 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -5054,9 +5340,9 @@ def __init__( self, *, resource: "SqlStoredProcedureResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(SqlStoredProcedureCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -5110,7 +5396,7 @@ class SqlStoredProcedureGetPropertiesResource(ExtendedResourceProperties, SqlSto :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -5127,7 +5413,7 @@ class SqlStoredProcedureGetPropertiesResource(ExtendedResourceProperties, SqlSto 'id': {'key': 'id', 'type': 'str'}, 'body': {'key': 'body', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -5246,8 +5532,8 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -5256,7 +5542,6 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -5273,9 +5558,9 @@ def __init__( self, *, resource: "SqlTriggerResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(SqlTriggerCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -5345,7 +5630,7 @@ class SqlTriggerGetPropertiesResource(ExtendedResourceProperties, SqlTriggerReso :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -5364,7 +5649,7 @@ class SqlTriggerGetPropertiesResource(ExtendedResourceProperties, SqlTriggerReso 'trigger_type': {'key': 'triggerType', 'type': 'str'}, 'trigger_operation': {'key': 'triggerOperation', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -5487,8 +5772,8 @@ class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): :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. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -5497,7 +5782,6 @@ class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -5514,9 +5798,9 @@ def __init__( self, *, resource: "SqlUserDefinedFunctionResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(SqlUserDefinedFunctionCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -5570,7 +5854,7 @@ class SqlUserDefinedFunctionGetPropertiesResource(ExtendedResourceProperties, Sq :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -5587,7 +5871,7 @@ class SqlUserDefinedFunctionGetPropertiesResource(ExtendedResourceProperties, Sq 'id': {'key': 'id', 'type': 'str'}, 'body': {'key': 'body', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -5706,8 +5990,8 @@ class TableCreateUpdateParameters(ARMResourceProperties): :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 the request. This - corresponds to the headers sent with the request. + :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: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ @@ -5716,7 +6000,6 @@ class TableCreateUpdateParameters(ARMResourceProperties): 'name': {'readonly': True}, 'type': {'readonly': True}, 'resource': {'required': True}, - 'options': {'required': True}, } _attribute_map = { @@ -5733,9 +6016,9 @@ def __init__( self, *, resource: "TableResource", - options: "CreateUpdateOptions", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + options: Optional["CreateUpdateOptions"] = None, **kwargs ): super(TableCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) @@ -5807,7 +6090,7 @@ class TableGetPropertiesResource(ExtendedResourceProperties, TableResource): :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -5823,7 +6106,7 @@ class TableGetPropertiesResource(ExtendedResourceProperties, TableResource): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } @@ -6009,7 +6292,7 @@ class ThroughputSettingsGetPropertiesResource(ExtendedResourceProperties, Throug :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 + :vartype ts: float :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str @@ -6029,7 +6312,7 @@ class ThroughputSettingsGetPropertiesResource(ExtendedResourceProperties, Throug 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'object'}, + 'ts': {'key': '_ts', 'type': 'float'}, 'etag': {'key': '_etag', 'type': 'str'}, } 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 index 7518e017eb89..58b06c43ffa5 100644 --- 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class CassandraResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_cassandra_keyspaces( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.CassandraKeyspaceListResult"] + # type: (...) -> Iterable["_models.CassandraKeyspaceListResult"] """Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,12 +65,12 @@ def list_cassandra_keyspaces( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraKeyspaceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraKeyspaceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -129,7 +129,7 @@ def get_cassandra_keyspace( keyspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.CassandraKeyspaceGetResults" + # type: (...) -> "_models.CassandraKeyspaceGetResults" """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. @@ -144,12 +144,12 @@ def get_cassandra_keyspace( :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraKeyspaceGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraKeyspaceGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -191,16 +191,16 @@ def _create_update_cassandra_keyspace_initial( resource_group_name, # type: str account_name, # type: str keyspace_name, # type: str - create_update_cassandra_keyspace_parameters, # type: "models.CassandraKeyspaceCreateUpdateParameters" + create_update_cassandra_keyspace_parameters, # type: "_models.CassandraKeyspaceCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.CassandraKeyspaceGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.CassandraKeyspaceGetResults"]] + # type: (...) -> Optional["_models.CassandraKeyspaceGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CassandraKeyspaceGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -249,10 +249,10 @@ def begin_create_update_cassandra_keyspace( resource_group_name, # type: str account_name, # type: str keyspace_name, # type: str - create_update_cassandra_keyspace_parameters, # type: "models.CassandraKeyspaceCreateUpdateParameters" + create_update_cassandra_keyspace_parameters, # type: "_models.CassandraKeyspaceCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.CassandraKeyspaceGetResults"] + # type: (...) -> LROPoller["_models.CassandraKeyspaceGetResults"] """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -275,7 +275,7 @@ def begin_create_update_cassandra_keyspace( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraKeyspaceGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraKeyspaceGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -301,7 +301,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -328,7 +335,7 @@ def _delete_cassandra_keyspace_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_cassandra_keyspace_initial.metadata['url'] # type: ignore @@ -409,7 +416,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,7 +444,7 @@ def get_cassandra_keyspace_throughput( keyspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ThroughputSettingsGetResults" + # type: (...) -> "_models.ThroughputSettingsGetResults" """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. @@ -445,12 +459,12 @@ def get_cassandra_keyspace_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -492,16 +506,16 @@ def _update_cassandra_keyspace_throughput_initial( resource_group_name, # type: str account_name, # type: str keyspace_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -550,10 +564,10 @@ def begin_update_cassandra_keyspace_throughput( resource_group_name, # type: str account_name, # type: str keyspace_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -576,7 +590,7 @@ def begin_update_cassandra_keyspace_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -602,7 +616,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -623,13 +644,13 @@ def _migrate_cassandra_keyspace_to_autoscale_initial( keyspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -656,7 +677,8 @@ def _migrate_cassandra_keyspace_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -675,7 +697,7 @@ def begin_migrate_cassandra_keyspace_to_autoscale( keyspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -695,7 +717,7 @@ def begin_migrate_cassandra_keyspace_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -720,7 +742,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -741,13 +770,13 @@ def _migrate_cassandra_keyspace_to_manual_throughput_initial( keyspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -774,7 +803,8 @@ def _migrate_cassandra_keyspace_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -793,7 +823,7 @@ def begin_migrate_cassandra_keyspace_to_manual_throughput( keyspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -813,7 +843,7 @@ def begin_migrate_cassandra_keyspace_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -838,7 +868,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,7 +896,7 @@ def list_cassandra_tables( keyspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.CassandraTableListResult"] + # type: (...) -> Iterable["_models.CassandraTableListResult"] """Lists the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -873,12 +910,12 @@ def list_cassandra_tables( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraTableListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraTableListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -939,7 +976,7 @@ def get_cassandra_table( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.CassandraTableGetResults" + # type: (...) -> "_models.CassandraTableGetResults" """Gets the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -955,12 +992,12 @@ def get_cassandra_table( :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraTableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraTableGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1004,16 +1041,16 @@ def _create_update_cassandra_table_initial( account_name, # type: str keyspace_name, # type: str table_name, # type: str - create_update_cassandra_table_parameters, # type: "models.CassandraTableCreateUpdateParameters" + create_update_cassandra_table_parameters, # type: "_models.CassandraTableCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.CassandraTableGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.CassandraTableGetResults"]] + # type: (...) -> Optional["_models.CassandraTableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CassandraTableGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1064,10 +1101,10 @@ def begin_create_update_cassandra_table( account_name, # type: str keyspace_name, # type: str table_name, # type: str - create_update_cassandra_table_parameters, # type: "models.CassandraTableCreateUpdateParameters" + create_update_cassandra_table_parameters, # type: "_models.CassandraTableCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.CassandraTableGetResults"] + # type: (...) -> LROPoller["_models.CassandraTableGetResults"] """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1092,7 +1129,7 @@ def begin_create_update_cassandra_table( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.CassandraTableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraTableGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1119,7 +1156,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1147,7 +1192,7 @@ def _delete_cassandra_table_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_cassandra_table_initial.metadata['url'] # type: ignore @@ -1233,7 +1278,15 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1255,7 +1308,7 @@ def get_cassandra_table_throughput( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ThroughputSettingsGetResults" + # type: (...) -> "_models.ThroughputSettingsGetResults" """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. @@ -1272,12 +1325,12 @@ def get_cassandra_table_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1321,16 +1374,16 @@ def _update_cassandra_table_throughput_initial( account_name, # type: str keyspace_name, # type: str table_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1381,10 +1434,10 @@ def begin_update_cassandra_table_throughput( account_name, # type: str keyspace_name, # type: str table_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1409,7 +1462,7 @@ def begin_update_cassandra_table_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1436,7 +1489,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1458,13 +1519,13 @@ def _migrate_cassandra_table_to_autoscale_initial( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1492,7 +1553,8 @@ def _migrate_cassandra_table_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1512,7 +1574,7 @@ def begin_migrate_cassandra_table_to_autoscale( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1534,7 +1596,7 @@ def begin_migrate_cassandra_table_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1560,7 +1622,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1582,13 +1652,13 @@ def _migrate_cassandra_table_to_manual_throughput_initial( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1616,7 +1686,8 @@ def _migrate_cassandra_table_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1636,7 +1707,7 @@ def begin_migrate_cassandra_table_to_manual_throughput( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1658,7 +1729,7 @@ def begin_migrate_cassandra_table_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1684,7 +1755,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'keyspaceName': self._serialize.url("keyspace_name", keyspace_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: 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 287edbda956f..5a2042c12eae 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class CollectionOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -54,7 +54,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricListResult"] + # type: (...) -> Iterable["_models.MetricListResult"] """Retrieves the metrics determined by the given filter for the given database account and collection. @@ -75,12 +75,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -144,7 +144,7 @@ def list_usages( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.UsagesResult"] + # type: (...) -> Iterable["_models.UsagesResult"] """Retrieves the usages (most recent storage data) for the given collection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -163,12 +163,12 @@ def list_usages( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.UsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -232,7 +232,7 @@ def list_metric_definitions( collection_rid, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricDefinitionsListResult"] + # type: (...) -> Iterable["_models.MetricDefinitionsListResult"] """Retrieves metric definitions for the given collection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -248,12 +248,12 @@ def list_metric_definitions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 0e9a899a729e..138a5acf84e5 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class CollectionPartitionOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -54,7 +54,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PartitionMetricListResult"] + # type: (...) -> Iterable["_models.PartitionMetricListResult"] """Retrieves the metrics determined by the given filter for the given collection, split by partition. @@ -75,12 +75,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -144,7 +144,7 @@ def list_usages( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PartitionUsagesResult"] + # type: (...) -> Iterable["_models.PartitionUsagesResult"] """Retrieves the usages (most recent storage data) for the given collection, split by partition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -163,12 +163,12 @@ def list_usages( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionUsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 3b8221aba917..513e096da50f 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class CollectionPartitionRegionOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PartitionMetricListResult"] + # type: (...) -> Iterable["_models.PartitionMetricListResult"] """Retrieves the metrics determined by the given filter for the given collection and region, split by partition. @@ -78,12 +78,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 ebff6f3b51e3..a1e38f1b6001 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class CollectionRegionOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricListResult"] + # type: (...) -> Iterable["_models.MetricListResult"] """Retrieves the metrics determined by the given filter for the given database account, collection and region. @@ -78,12 +78,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 fb65e71191c9..1aee75e03ee8 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DatabaseAccountRegionOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricListResult"] + # type: (...) -> Iterable["_models.MetricListResult"] """Retrieves the metrics determined by the given filter for the given database account and region. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -71,12 +71,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 b59f5d7a76f0..88b8ed3afba1 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DatabaseAccountsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DatabaseAccountGetResults" + # type: (...) -> "_models.DatabaseAccountGetResults" """Retrieves the properties of an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,12 +65,12 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -110,16 +110,16 @@ def _update_initial( self, resource_group_name, # type: str account_name, # type: str - update_parameters, # type: "models.DatabaseAccountUpdateParameters" + update_parameters, # type: "_models.DatabaseAccountUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.DatabaseAccountGetResults" - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + # type: (...) -> "_models.DatabaseAccountGetResults" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -164,10 +164,10 @@ def begin_update( self, resource_group_name, # type: str account_name, # type: str - update_parameters, # type: "models.DatabaseAccountUpdateParameters" + update_parameters, # type: "_models.DatabaseAccountUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DatabaseAccountGetResults"] + # type: (...) -> LROPoller["_models.DatabaseAccountGetResults"] """Updates the properties of an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -187,7 +187,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -212,7 +212,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -230,16 +236,16 @@ def _create_or_update_initial( self, resource_group_name, # type: str account_name, # type: str - create_update_parameters, # type: "models.DatabaseAccountCreateUpdateParameters" + create_update_parameters, # type: "_models.DatabaseAccountCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.DatabaseAccountGetResults" - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + # type: (...) -> "_models.DatabaseAccountGetResults" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -284,10 +290,10 @@ def begin_create_or_update( self, resource_group_name, # type: str account_name, # type: str - create_update_parameters, # type: "models.DatabaseAccountCreateUpdateParameters" + create_update_parameters, # type: "_models.DatabaseAccountCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DatabaseAccountGetResults"] + # type: (...) -> LROPoller["_models.DatabaseAccountGetResults"] """Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. @@ -308,7 +314,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -333,7 +339,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -359,7 +371,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -435,7 +447,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -453,7 +471,7 @@ def _failover_priority_change_initial( self, resource_group_name, # type: str account_name, # type: str - failover_parameters, # type: "models.FailoverPolicies" + failover_parameters, # type: "_models.FailoverPolicies" **kwargs # type: Any ): # type: (...) -> None @@ -462,7 +480,7 @@ def _failover_priority_change_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") # Construct URL @@ -502,7 +520,7 @@ def begin_failover_priority_change( self, resource_group_name, # type: str account_name, # type: str - failover_parameters, # type: "models.FailoverPolicies" + failover_parameters, # type: "_models.FailoverPolicies" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -550,7 +568,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -568,7 +592,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DatabaseAccountsListResult"] + # type: (...) -> Iterable["_models.DatabaseAccountsListResult"] """Lists all the Azure Cosmos DB database accounts available under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -576,12 +600,12 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -636,7 +660,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.DatabaseAccountsListResult"] + # type: (...) -> Iterable["_models.DatabaseAccountsListResult"] """Lists all the Azure Cosmos DB database accounts available under the given resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -646,12 +670,12 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -708,7 +732,7 @@ def list_keys( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DatabaseAccountListKeysResult" + # type: (...) -> "_models.DatabaseAccountListKeysResult" """Lists the access keys for the specified Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -720,12 +744,12 @@ def list_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountListKeysResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -767,7 +791,7 @@ def list_connection_strings( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DatabaseAccountListConnectionStringsResult" + # type: (...) -> "_models.DatabaseAccountListConnectionStringsResult" """Lists the connection strings for the specified Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -779,12 +803,12 @@ def list_connection_strings( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListConnectionStringsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountListConnectionStringsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListConnectionStringsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -824,7 +848,7 @@ def _offline_region_initial( self, resource_group_name, # type: str account_name, # type: str - region_parameter_for_offline, # type: "models.RegionForOnlineOffline" + region_parameter_for_offline, # type: "_models.RegionForOnlineOffline" **kwargs # type: Any ): # type: (...) -> None @@ -833,7 +857,7 @@ def _offline_region_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -864,7 +888,7 @@ def _offline_region_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -876,7 +900,7 @@ def begin_offline_region( self, resource_group_name, # type: str account_name, # type: str - region_parameter_for_offline, # type: "models.RegionForOnlineOffline" + region_parameter_for_offline, # type: "_models.RegionForOnlineOffline" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -921,7 +945,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -939,7 +969,7 @@ def _online_region_initial( self, resource_group_name, # type: str account_name, # type: str - region_parameter_for_online, # type: "models.RegionForOnlineOffline" + region_parameter_for_online, # type: "_models.RegionForOnlineOffline" **kwargs # type: Any ): # type: (...) -> None @@ -948,7 +978,7 @@ def _online_region_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -979,7 +1009,7 @@ def _online_region_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -991,7 +1021,7 @@ def begin_online_region( self, resource_group_name, # type: str account_name, # type: str - region_parameter_for_online, # type: "models.RegionForOnlineOffline" + region_parameter_for_online, # type: "_models.RegionForOnlineOffline" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -1036,7 +1066,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1056,7 +1092,7 @@ def get_read_only_keys( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DatabaseAccountListReadOnlyKeysResult" + # type: (...) -> "_models.DatabaseAccountListReadOnlyKeysResult" """Lists the read-only access keys for the specified Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1068,12 +1104,12 @@ def get_read_only_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountListReadOnlyKeysResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListReadOnlyKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1115,7 +1151,7 @@ def list_read_only_keys( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DatabaseAccountListReadOnlyKeysResult" + # type: (...) -> "_models.DatabaseAccountListReadOnlyKeysResult" """Lists the read-only access keys for the specified Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1127,12 +1163,12 @@ def list_read_only_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseAccountListReadOnlyKeysResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListReadOnlyKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1172,7 +1208,7 @@ def _regenerate_key_initial( self, resource_group_name, # type: str account_name, # type: str - key_to_regenerate, # type: "models.DatabaseAccountRegenerateKeyParameters" + key_to_regenerate, # type: "_models.DatabaseAccountRegenerateKeyParameters" **kwargs # type: Any ): # type: (...) -> None @@ -1181,7 +1217,7 @@ def _regenerate_key_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") # Construct URL @@ -1221,7 +1257,7 @@ def begin_regenerate_key( self, resource_group_name, # type: str account_name, # type: str - key_to_regenerate, # type: "models.DatabaseAccountRegenerateKeyParameters" + key_to_regenerate, # type: "_models.DatabaseAccountRegenerateKeyParameters" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -1266,7 +1302,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1302,7 +1344,7 @@ def check_name_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self.check_name_exists.metadata['url'] # type: ignore @@ -1339,7 +1381,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricListResult"] + # type: (...) -> Iterable["_models.MetricListResult"] """Retrieves the metrics determined by the given filter for the given database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1355,12 +1397,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -1420,7 +1462,7 @@ def list_usages( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.UsagesResult"] + # type: (...) -> Iterable["_models.UsagesResult"] """Retrieves the usages (most recent data) for the given database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1435,12 +1477,12 @@ def list_usages( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.UsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -1500,7 +1542,7 @@ def list_metric_definitions( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricDefinitionsListResult"] + # type: (...) -> Iterable["_models.MetricDefinitionsListResult"] """Retrieves metric definitions for the given database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1512,12 +1554,12 @@ def list_metric_definitions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 1213ef91c4a7..67114608a325 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DatabaseOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricListResult"] + # type: (...) -> Iterable["_models.MetricListResult"] """Retrieves the metrics determined by the given filter for the given database account and database. @@ -72,12 +72,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -139,7 +139,7 @@ def list_usages( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.UsagesResult"] + # type: (...) -> Iterable["_models.UsagesResult"] """Retrieves the usages (most recent data) for the given database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -156,12 +156,12 @@ def list_usages( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.UsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -223,7 +223,7 @@ def list_metric_definitions( database_rid, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricDefinitionsListResult"] + # type: (...) -> Iterable["_models.MetricDefinitionsListResult"] """Retrieves metric definitions for the given database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -237,12 +237,12 @@ def list_metric_definitions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 index e6bdcee8c086..a71ee3122360 100644 --- 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class GremlinResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_gremlin_databases( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.GremlinDatabaseListResult"] + # type: (...) -> Iterable["_models.GremlinDatabaseListResult"] """Lists the Gremlin databases under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,12 +65,12 @@ def list_gremlin_databases( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinDatabaseListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinDatabaseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -129,7 +129,7 @@ def get_gremlin_database( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GremlinDatabaseGetResults" + # type: (...) -> "_models.GremlinDatabaseGetResults" """Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. @@ -144,12 +144,12 @@ def get_gremlin_database( :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinDatabaseGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -191,16 +191,16 @@ def _create_update_gremlin_database_initial( resource_group_name, # type: str account_name, # type: str database_name, # type: str - create_update_gremlin_database_parameters, # type: "models.GremlinDatabaseCreateUpdateParameters" + create_update_gremlin_database_parameters, # type: "_models.GremlinDatabaseCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.GremlinDatabaseGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GremlinDatabaseGetResults"]] + # type: (...) -> Optional["_models.GremlinDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GremlinDatabaseGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -249,10 +249,10 @@ def begin_create_update_gremlin_database( resource_group_name, # type: str account_name, # type: str database_name, # type: str - create_update_gremlin_database_parameters, # type: "models.GremlinDatabaseCreateUpdateParameters" + create_update_gremlin_database_parameters, # type: "_models.GremlinDatabaseCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GremlinDatabaseGetResults"] + # type: (...) -> LROPoller["_models.GremlinDatabaseGetResults"] """Create or update an Azure Cosmos DB Gremlin database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -275,7 +275,7 @@ def begin_create_update_gremlin_database( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -301,7 +301,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -328,7 +335,7 @@ def _delete_gremlin_database_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_gremlin_database_initial.metadata['url'] # type: ignore @@ -409,7 +416,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,7 +444,7 @@ def get_gremlin_database_throughput( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ThroughputSettingsGetResults" + # type: (...) -> "_models.ThroughputSettingsGetResults" """Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. @@ -445,12 +459,12 @@ def get_gremlin_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -492,16 +506,16 @@ def _update_gremlin_database_throughput_initial( resource_group_name, # type: str account_name, # type: str database_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -550,10 +564,10 @@ def begin_update_gremlin_database_throughput( resource_group_name, # type: str account_name, # type: str database_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Update RUs per second of an Azure Cosmos DB Gremlin database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -576,7 +590,7 @@ def begin_update_gremlin_database_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -602,7 +616,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -623,13 +644,13 @@ def _migrate_gremlin_database_to_autoscale_initial( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -656,7 +677,8 @@ def _migrate_gremlin_database_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -675,7 +697,7 @@ def begin_migrate_gremlin_database_to_autoscale( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -695,7 +717,7 @@ def begin_migrate_gremlin_database_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -720,7 +742,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -741,13 +770,13 @@ def _migrate_gremlin_database_to_manual_throughput_initial( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -774,7 +803,8 @@ def _migrate_gremlin_database_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -793,7 +823,7 @@ def begin_migrate_gremlin_database_to_manual_throughput( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -813,7 +843,7 @@ def begin_migrate_gremlin_database_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -838,7 +868,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,7 +896,7 @@ def list_gremlin_graphs( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.GremlinGraphListResult"] + # type: (...) -> Iterable["_models.GremlinGraphListResult"] """Lists the Gremlin graph under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -873,12 +910,12 @@ def list_gremlin_graphs( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinGraphListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinGraphListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -939,7 +976,7 @@ def get_gremlin_graph( graph_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GremlinGraphGetResults" + # type: (...) -> "_models.GremlinGraphGetResults" """Gets the Gremlin graph under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -955,12 +992,12 @@ def get_gremlin_graph( :rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinGraphGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinGraphGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1004,16 +1041,16 @@ def _create_update_gremlin_graph_initial( account_name, # type: str database_name, # type: str graph_name, # type: str - create_update_gremlin_graph_parameters, # type: "models.GremlinGraphCreateUpdateParameters" + create_update_gremlin_graph_parameters, # type: "_models.GremlinGraphCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.GremlinGraphGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GremlinGraphGetResults"]] + # type: (...) -> Optional["_models.GremlinGraphGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GremlinGraphGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1064,10 +1101,10 @@ def begin_create_update_gremlin_graph( account_name, # type: str database_name, # type: str graph_name, # type: str - create_update_gremlin_graph_parameters, # type: "models.GremlinGraphCreateUpdateParameters" + create_update_gremlin_graph_parameters, # type: "_models.GremlinGraphCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GremlinGraphGetResults"] + # type: (...) -> LROPoller["_models.GremlinGraphGetResults"] """Create or update an Azure Cosmos DB Gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1092,7 +1129,7 @@ def begin_create_update_gremlin_graph( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GremlinGraphGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinGraphGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1119,7 +1156,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1147,7 +1192,7 @@ def _delete_gremlin_graph_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_gremlin_graph_initial.metadata['url'] # type: ignore @@ -1233,7 +1278,15 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1255,7 +1308,7 @@ def get_gremlin_graph_throughput( graph_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ThroughputSettingsGetResults" + # type: (...) -> "_models.ThroughputSettingsGetResults" """Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. @@ -1272,12 +1325,12 @@ def get_gremlin_graph_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1321,16 +1374,16 @@ def _update_gremlin_graph_throughput_initial( account_name, # type: str database_name, # type: str graph_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1381,10 +1434,10 @@ def begin_update_gremlin_graph_throughput( account_name, # type: str database_name, # type: str graph_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Update RUs per second of an Azure Cosmos DB Gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1409,7 +1462,7 @@ def begin_update_gremlin_graph_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1436,7 +1489,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1458,13 +1519,13 @@ def _migrate_gremlin_graph_to_autoscale_initial( graph_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1492,7 +1553,8 @@ def _migrate_gremlin_graph_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1512,7 +1574,7 @@ def begin_migrate_gremlin_graph_to_autoscale( graph_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1534,7 +1596,7 @@ def begin_migrate_gremlin_graph_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1560,7 +1622,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1582,13 +1652,13 @@ def _migrate_gremlin_graph_to_manual_throughput_initial( graph_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1616,7 +1686,8 @@ def _migrate_gremlin_graph_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1636,7 +1707,7 @@ def begin_migrate_gremlin_graph_to_manual_throughput( graph_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1658,7 +1729,7 @@ def begin_migrate_gremlin_graph_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1684,7 +1755,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'graphName': self._serialize.url("graph_name", graph_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: 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 index 94c214241dee..cd400da2555f 100644 --- 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class MongoDBResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_mongo_db_databases( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MongoDBDatabaseListResult"] + # type: (...) -> Iterable["_models.MongoDBDatabaseListResult"] """Lists the MongoDB databases under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,12 +65,12 @@ def list_mongo_db_databases( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBDatabaseListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBDatabaseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -129,7 +129,7 @@ def get_mongo_db_database( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.MongoDBDatabaseGetResults" + # type: (...) -> "_models.MongoDBDatabaseGetResults" """Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. @@ -144,12 +144,12 @@ def get_mongo_db_database( :rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBDatabaseGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -191,16 +191,16 @@ def _create_update_mongo_db_database_initial( resource_group_name, # type: str account_name, # type: str database_name, # type: str - create_update_mongo_db_database_parameters, # type: "models.MongoDBDatabaseCreateUpdateParameters" + create_update_mongo_db_database_parameters, # type: "_models.MongoDBDatabaseCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.MongoDBDatabaseGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MongoDBDatabaseGetResults"]] + # type: (...) -> Optional["_models.MongoDBDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoDBDatabaseGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -249,10 +249,10 @@ def begin_create_update_mongo_db_database( resource_group_name, # type: str account_name, # type: str database_name, # type: str - create_update_mongo_db_database_parameters, # type: "models.MongoDBDatabaseCreateUpdateParameters" + create_update_mongo_db_database_parameters, # type: "_models.MongoDBDatabaseCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.MongoDBDatabaseGetResults"] + # type: (...) -> LROPoller["_models.MongoDBDatabaseGetResults"] """Create or updates Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -275,7 +275,7 @@ def begin_create_update_mongo_db_database( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -301,7 +301,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -328,7 +335,7 @@ def _delete_mongo_db_database_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_mongo_db_database_initial.metadata['url'] # type: ignore @@ -409,7 +416,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,7 +444,7 @@ def get_mongo_db_database_throughput( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ThroughputSettingsGetResults" + # type: (...) -> "_models.ThroughputSettingsGetResults" """Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. @@ -445,12 +459,12 @@ def get_mongo_db_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -492,16 +506,16 @@ def _update_mongo_db_database_throughput_initial( resource_group_name, # type: str account_name, # type: str database_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -533,7 +547,8 @@ def _update_mongo_db_database_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -550,10 +565,10 @@ def begin_update_mongo_db_database_throughput( resource_group_name, # type: str account_name, # type: str database_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Update RUs per second of the an Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -576,7 +591,7 @@ def begin_update_mongo_db_database_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -602,7 +617,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -623,13 +645,13 @@ def _migrate_mongo_db_database_to_autoscale_initial( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -656,7 +678,8 @@ def _migrate_mongo_db_database_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -675,7 +698,7 @@ def begin_migrate_mongo_db_database_to_autoscale( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -695,7 +718,7 @@ def begin_migrate_mongo_db_database_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -720,7 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -741,13 +771,13 @@ def _migrate_mongo_db_database_to_manual_throughput_initial( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -774,7 +804,8 @@ def _migrate_mongo_db_database_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -793,7 +824,7 @@ def begin_migrate_mongo_db_database_to_manual_throughput( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -813,7 +844,7 @@ def begin_migrate_mongo_db_database_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -838,7 +869,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,7 +897,7 @@ def list_mongo_db_collections( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MongoDBCollectionListResult"] + # type: (...) -> Iterable["_models.MongoDBCollectionListResult"] """Lists the MongoDB collection under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -873,12 +911,12 @@ def list_mongo_db_collections( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBCollectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -939,7 +977,7 @@ def get_mongo_db_collection( collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.MongoDBCollectionGetResults" + # type: (...) -> "_models.MongoDBCollectionGetResults" """Gets the MongoDB collection under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -955,12 +993,12 @@ def get_mongo_db_collection( :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBCollectionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBCollectionGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1004,16 +1042,16 @@ def _create_update_mongo_db_collection_initial( account_name, # type: str database_name, # type: str collection_name, # type: str - create_update_mongo_db_collection_parameters, # type: "models.MongoDBCollectionCreateUpdateParameters" + create_update_mongo_db_collection_parameters, # type: "_models.MongoDBCollectionCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.MongoDBCollectionGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MongoDBCollectionGetResults"]] + # type: (...) -> Optional["_models.MongoDBCollectionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoDBCollectionGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1064,10 +1102,10 @@ def begin_create_update_mongo_db_collection( account_name, # type: str database_name, # type: str collection_name, # type: str - create_update_mongo_db_collection_parameters, # type: "models.MongoDBCollectionCreateUpdateParameters" + create_update_mongo_db_collection_parameters, # type: "_models.MongoDBCollectionCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.MongoDBCollectionGetResults"] + # type: (...) -> LROPoller["_models.MongoDBCollectionGetResults"] """Create or update an Azure Cosmos DB MongoDB Collection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1092,7 +1130,7 @@ def begin_create_update_mongo_db_collection( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.MongoDBCollectionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBCollectionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1119,7 +1157,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1147,7 +1193,7 @@ def _delete_mongo_db_collection_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_mongo_db_collection_initial.metadata['url'] # type: ignore @@ -1233,7 +1279,15 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1255,7 +1309,7 @@ def get_mongo_db_collection_throughput( collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ThroughputSettingsGetResults" + # type: (...) -> "_models.ThroughputSettingsGetResults" """Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. @@ -1272,12 +1326,12 @@ def get_mongo_db_collection_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1321,16 +1375,16 @@ def _update_mongo_db_collection_throughput_initial( account_name, # type: str database_name, # type: str collection_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1381,10 +1435,10 @@ def begin_update_mongo_db_collection_throughput( account_name, # type: str database_name, # type: str collection_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1409,7 +1463,7 @@ def begin_update_mongo_db_collection_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1436,7 +1490,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1458,13 +1520,13 @@ def _migrate_mongo_db_collection_to_autoscale_initial( collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1492,7 +1554,8 @@ def _migrate_mongo_db_collection_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1512,7 +1575,7 @@ def begin_migrate_mongo_db_collection_to_autoscale( collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1534,7 +1597,7 @@ def begin_migrate_mongo_db_collection_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1560,7 +1623,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1582,13 +1653,13 @@ def _migrate_mongo_db_collection_to_manual_throughput_initial( collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1616,7 +1687,8 @@ def _migrate_mongo_db_collection_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1636,7 +1708,7 @@ def begin_migrate_mongo_db_collection_to_manual_throughput( collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1658,7 +1730,7 @@ def begin_migrate_mongo_db_collection_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1684,7 +1756,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'collectionName': self._serialize.url("collection_name", collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py index 239a201ec9fc..75e9b124a5fa 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class NotebookWorkspacesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_by_database_account( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.NotebookWorkspaceListResult"] + # type: (...) -> Iterable["_models.NotebookWorkspaceListResult"] """Gets the notebook workspace resources of an existing Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,12 +65,12 @@ def list_by_database_account( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.NotebookWorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspaceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspaceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -112,7 +112,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -127,10 +127,10 @@ def get( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] **kwargs # type: Any ): - # type: (...) -> "models.NotebookWorkspace" + # type: (...) -> "_models.NotebookWorkspace" """Gets the notebook workspace for a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -144,12 +144,12 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspace"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -176,7 +176,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotebookWorkspace', pipeline_response) @@ -191,17 +191,17 @@ def _create_or_update_initial( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] - notebook_create_update_parameters, # type: "models.ARMProxyResource" + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] + notebook_create_update_parameters, # type: "_models.ARMProxyResource" **kwargs # type: Any ): - # type: (...) -> "models.NotebookWorkspace" - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspace"] + # type: (...) -> "_models.NotebookWorkspace" + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -233,7 +233,7 @@ def _create_or_update_initial( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotebookWorkspace', pipeline_response) @@ -248,11 +248,11 @@ def begin_create_or_update( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] - notebook_create_update_parameters, # type: "models.ARMProxyResource" + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] + notebook_create_update_parameters, # type: "_models.ARMProxyResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.NotebookWorkspace"] + # type: (...) -> LROPoller["_models.NotebookWorkspace"] """Creates the notebook workspace for a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -275,7 +275,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspace"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -301,7 +301,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("notebook_workspace_name", notebook_workspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -319,7 +326,7 @@ def _delete_initial( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] **kwargs # type: Any ): # type: (...) -> None @@ -328,7 +335,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -355,7 +362,7 @@ def _delete_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -367,7 +374,7 @@ def begin_delete( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -412,7 +419,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("notebook_workspace_name", notebook_workspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,10 +444,10 @@ def list_connection_info( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] **kwargs # type: Any ): - # type: (...) -> "models.NotebookWorkspaceConnectionInfoResult" + # type: (...) -> "_models.NotebookWorkspaceConnectionInfoResult" """Retrieves the connection info for the notebook workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -447,12 +461,12 @@ def list_connection_info( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookWorkspaceConnectionInfoResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspaceConnectionInfoResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -479,7 +493,7 @@ def list_connection_info( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotebookWorkspaceConnectionInfoResult', pipeline_response) @@ -494,7 +508,7 @@ def _regenerate_auth_token_initial( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] **kwargs # type: Any ): # type: (...) -> None @@ -503,7 +517,7 @@ def _regenerate_auth_token_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -530,7 +544,7 @@ def _regenerate_auth_token_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -542,7 +556,7 @@ def begin_regenerate_auth_token( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -587,7 +601,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("notebook_workspace_name", notebook_workspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -605,7 +626,7 @@ def _start_initial( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] **kwargs # type: Any ): # type: (...) -> None @@ -614,7 +635,7 @@ def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -641,7 +662,7 @@ def _start_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -653,7 +674,7 @@ def begin_start( self, resource_group_name, # type: str account_name, # type: str - notebook_workspace_name, # type: Union[str, "models.NotebookWorkspaceName"] + notebook_workspace_name, # type: Union[str, "_models.NotebookWorkspaceName"] **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -698,7 +719,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("notebook_workspace_name", notebook_workspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: 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 dd795f7616f5..26103300ab1f 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Cosmos DB Resource Provider operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,12 +57,12 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 884f5b643b8b..a9a5037e6222 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PartitionKeyRangeIdOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PartitionMetricListResult"] + # type: (...) -> Iterable["_models.PartitionMetricListResult"] """Retrieves the metrics determined by the given filter for the given partition key range id. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -77,12 +77,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 dd3b1a3f530f..98411b4d9ed4 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PartitionKeyRangeIdRegionOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -56,7 +56,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PartitionMetricListResult"] + # type: (...) -> Iterable["_models.PartitionMetricListResult"] """Retrieves the metrics determined by the given filter for the given partition key range id and region. @@ -81,12 +81,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PartitionMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartitionMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 4f53f32265c9..80b22f3c3d5d 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PercentileOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PercentileMetricListResult"] + # type: (...) -> Iterable["_models.PercentileMetricListResult"] """Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. @@ -69,12 +69,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PercentileMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PercentileMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 610f3fe92a88..b2f2eceac31e 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PercentileSourceTargetOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -54,7 +54,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PercentileMetricListResult"] + # type: (...) -> Iterable["_models.PercentileMetricListResult"] """Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. @@ -77,12 +77,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PercentileMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PercentileMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): 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 6ffe7c7f843b..34172ab09f59 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PercentileTargetOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_metrics( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PercentileMetricListResult"] + # type: (...) -> Iterable["_models.PercentileMetricListResult"] """Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. @@ -73,12 +73,12 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PercentileMetricListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PercentileMetricListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_endpoint_connections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_endpoint_connections_operations.py index d729fbe59ac3..2cf77ec229a3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_endpoint_connections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_endpoint_connections_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_by_database_account( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PrivateEndpointConnectionListResult"] + # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] """List all private endpoint connections on a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,12 +65,12 @@ def list_by_database_account( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -129,7 +129,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnectionAutoGenerated" + # type: (...) -> "_models.PrivateEndpointConnection" """Gets a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -139,16 +139,16 @@ def get( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionAutoGenerated, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionAutoGenerated + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionAutoGenerated"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -177,7 +177,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionAutoGenerated', pipeline_response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -190,16 +190,16 @@ def _create_or_update_initial( resource_group_name, # type: str account_name, # type: str private_endpoint_connection_name, # type: str - parameters, # type: "models.PrivateEndpointConnectionAutoGenerated" + parameters, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnectionAutoGenerated"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnectionAutoGenerated"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -223,7 +223,7 @@ def _create_or_update_initial( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnectionAutoGenerated') + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -231,12 +231,12 @@ def _create_or_update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnectionAutoGenerated', pipeline_response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -249,10 +249,10 @@ def begin_create_or_update( resource_group_name, # type: str account_name, # type: str private_endpoint_connection_name, # type: str - parameters, # type: "models.PrivateEndpointConnectionAutoGenerated" + parameters, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnectionAutoGenerated"] + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] """Approve or reject a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -262,19 +262,19 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param parameters: - :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionAutoGenerated + :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnectionAutoGenerated or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionAutoGenerated] + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionAutoGenerated"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -294,13 +294,20 @@ def begin_create_or_update( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionAutoGenerated', pipeline_response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -327,7 +334,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -354,7 +361,7 @@ def _delete_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -411,7 +418,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_link_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_link_resources_operations.py index 73f16fab7f4f..6b78adaac46d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_link_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_link_resources_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list_by_database_account( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PrivateLinkResourceListResult"] + # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] """Gets the private link resources that need to be created for a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,12 +63,12 @@ def list_by_database_account( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -127,7 +127,7 @@ def get( group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResource" + # type: (...) -> "_models.PrivateLinkResource" """Gets the private link resources that need to be created for a Cosmos DB account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,12 +141,12 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01-preview" + api_version = "2021-01-15" accept = "application/json" # Construct URL 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 index 6816baf36ebe..215bb64ac376 100644 --- 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class SqlResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_sql_databases( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.SqlDatabaseListResult"] + # type: (...) -> Iterable["_models.SqlDatabaseListResult"] """Lists the SQL databases under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,12 +65,12 @@ def list_sql_databases( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlDatabaseListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlDatabaseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -129,7 +129,7 @@ def get_sql_database( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.SqlDatabaseGetResults" + # type: (...) -> "_models.SqlDatabaseGetResults" """Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. @@ -144,12 +144,12 @@ def get_sql_database( :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlDatabaseGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -191,16 +191,16 @@ def _create_update_sql_database_initial( resource_group_name, # type: str account_name, # type: str database_name, # type: str - create_update_sql_database_parameters, # type: "models.SqlDatabaseCreateUpdateParameters" + create_update_sql_database_parameters, # type: "_models.SqlDatabaseCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.SqlDatabaseGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlDatabaseGetResults"]] + # type: (...) -> Optional["_models.SqlDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlDatabaseGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -249,10 +249,10 @@ def begin_create_update_sql_database( resource_group_name, # type: str account_name, # type: str database_name, # type: str - create_update_sql_database_parameters, # type: "models.SqlDatabaseCreateUpdateParameters" + create_update_sql_database_parameters, # type: "_models.SqlDatabaseCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.SqlDatabaseGetResults"] + # type: (...) -> LROPoller["_models.SqlDatabaseGetResults"] """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -275,7 +275,7 @@ def begin_create_update_sql_database( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlDatabaseGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -301,7 +301,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -328,7 +335,7 @@ def _delete_sql_database_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_database_initial.metadata['url'] # type: ignore @@ -409,7 +416,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,7 +444,7 @@ def get_sql_database_throughput( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ThroughputSettingsGetResults" + # type: (...) -> "_models.ThroughputSettingsGetResults" """Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. @@ -445,12 +459,12 @@ def get_sql_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -492,16 +506,16 @@ def _update_sql_database_throughput_initial( resource_group_name, # type: str account_name, # type: str database_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -550,10 +564,10 @@ def begin_update_sql_database_throughput( resource_group_name, # type: str account_name, # type: str database_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -576,7 +590,7 @@ def begin_update_sql_database_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -602,7 +616,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -623,13 +644,13 @@ def _migrate_sql_database_to_autoscale_initial( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -656,7 +677,8 @@ def _migrate_sql_database_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -675,7 +697,7 @@ def begin_migrate_sql_database_to_autoscale( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -695,7 +717,7 @@ def begin_migrate_sql_database_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -720,7 +742,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -741,13 +770,13 @@ def _migrate_sql_database_to_manual_throughput_initial( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -774,7 +803,8 @@ def _migrate_sql_database_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -793,7 +823,7 @@ def begin_migrate_sql_database_to_manual_throughput( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -813,7 +843,7 @@ def begin_migrate_sql_database_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -838,7 +868,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,7 +896,7 @@ def list_sql_containers( database_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.SqlContainerListResult"] + # type: (...) -> Iterable["_models.SqlContainerListResult"] """Lists the SQL container under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -873,12 +910,12 @@ def list_sql_containers( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlContainerListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -939,7 +976,7 @@ def get_sql_container( container_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.SqlContainerGetResults" + # type: (...) -> "_models.SqlContainerGetResults" """Gets the SQL container under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -955,12 +992,12 @@ def get_sql_container( :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlContainerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1004,16 +1041,16 @@ def _create_update_sql_container_initial( account_name, # type: str database_name, # type: str container_name, # type: str - create_update_sql_container_parameters, # type: "models.SqlContainerCreateUpdateParameters" + create_update_sql_container_parameters, # type: "_models.SqlContainerCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.SqlContainerGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlContainerGetResults"]] + # type: (...) -> Optional["_models.SqlContainerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlContainerGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1064,10 +1101,10 @@ def begin_create_update_sql_container( account_name, # type: str database_name, # type: str container_name, # type: str - create_update_sql_container_parameters, # type: "models.SqlContainerCreateUpdateParameters" + create_update_sql_container_parameters, # type: "_models.SqlContainerCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.SqlContainerGetResults"] + # type: (...) -> LROPoller["_models.SqlContainerGetResults"] """Create or update an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1092,7 +1129,7 @@ def begin_create_update_sql_container( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlContainerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1119,7 +1156,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1147,7 +1192,7 @@ def _delete_sql_container_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_container_initial.metadata['url'] # type: ignore @@ -1233,7 +1278,15 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1255,7 +1308,7 @@ def get_sql_container_throughput( container_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ThroughputSettingsGetResults" + # type: (...) -> "_models.ThroughputSettingsGetResults" """Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. @@ -1272,12 +1325,12 @@ def get_sql_container_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1321,16 +1374,16 @@ def _update_sql_container_throughput_initial( account_name, # type: str database_name, # type: str container_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1381,10 +1434,10 @@ def begin_update_sql_container_throughput( account_name, # type: str database_name, # type: str container_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Update RUs per second of an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1409,7 +1462,7 @@ def begin_update_sql_container_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1436,7 +1489,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1458,13 +1519,13 @@ def _migrate_sql_container_to_autoscale_initial( container_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1492,7 +1553,8 @@ def _migrate_sql_container_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1512,7 +1574,7 @@ def begin_migrate_sql_container_to_autoscale( container_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1534,7 +1596,7 @@ def begin_migrate_sql_container_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1560,7 +1622,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1582,13 +1652,13 @@ def _migrate_sql_container_to_manual_throughput_initial( container_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1616,7 +1686,8 @@ def _migrate_sql_container_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1636,7 +1707,7 @@ def begin_migrate_sql_container_to_manual_throughput( container_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1658,7 +1729,7 @@ def begin_migrate_sql_container_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1684,7 +1755,15 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'containerName': self._serialize.url("container_name", container_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1706,7 +1785,7 @@ def list_sql_stored_procedures( container_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.SqlStoredProcedureListResult"] + # type: (...) -> Iterable["_models.SqlStoredProcedureListResult"] """Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1722,12 +1801,12 @@ def list_sql_stored_procedures( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlStoredProcedureListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlStoredProcedureListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlStoredProcedureListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -1771,8 +1850,9 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1790,7 +1870,7 @@ def get_sql_stored_procedure( stored_procedure_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.SqlStoredProcedureGetResults" + # type: (...) -> "_models.SqlStoredProcedureGetResults" """Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1808,12 +1888,12 @@ def get_sql_stored_procedure( :rtype: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlStoredProcedureGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlStoredProcedureGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -1859,16 +1939,16 @@ def _create_update_sql_stored_procedure_initial( database_name, # type: str container_name, # type: str stored_procedure_name, # type: str - create_update_sql_stored_procedure_parameters, # type: "models.SqlStoredProcedureCreateUpdateParameters" + create_update_sql_stored_procedure_parameters, # type: "_models.SqlStoredProcedureCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.SqlStoredProcedureGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlStoredProcedureGetResults"]] + # type: (...) -> Optional["_models.SqlStoredProcedureGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlStoredProcedureGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1921,10 +2001,10 @@ def begin_create_update_sql_stored_procedure( database_name, # type: str container_name, # type: str stored_procedure_name, # type: str - create_update_sql_stored_procedure_parameters, # type: "models.SqlStoredProcedureCreateUpdateParameters" + create_update_sql_stored_procedure_parameters, # type: "_models.SqlStoredProcedureCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.SqlStoredProcedureGetResults"] + # type: (...) -> LROPoller["_models.SqlStoredProcedureGetResults"] """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1951,7 +2031,7 @@ def begin_create_update_sql_stored_procedure( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlStoredProcedureGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlStoredProcedureGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1979,7 +2059,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2008,7 +2097,7 @@ def _delete_sql_stored_procedure_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_stored_procedure_initial.metadata['url'] # type: ignore @@ -2099,7 +2188,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2121,7 +2219,7 @@ def list_sql_user_defined_functions( container_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.SqlUserDefinedFunctionListResult"] + # type: (...) -> Iterable["_models.SqlUserDefinedFunctionListResult"] """Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2137,12 +2235,12 @@ def list_sql_user_defined_functions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlUserDefinedFunctionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlUserDefinedFunctionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -2205,7 +2303,7 @@ def get_sql_user_defined_function( user_defined_function_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.SqlUserDefinedFunctionGetResults" + # type: (...) -> "_models.SqlUserDefinedFunctionGetResults" """Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2223,12 +2321,12 @@ def get_sql_user_defined_function( :rtype: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlUserDefinedFunctionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlUserDefinedFunctionGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -2274,16 +2372,16 @@ def _create_update_sql_user_defined_function_initial( database_name, # type: str container_name, # type: str user_defined_function_name, # type: str - create_update_sql_user_defined_function_parameters, # type: "models.SqlUserDefinedFunctionCreateUpdateParameters" + create_update_sql_user_defined_function_parameters, # type: "_models.SqlUserDefinedFunctionCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.SqlUserDefinedFunctionGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlUserDefinedFunctionGetResults"]] + # type: (...) -> Optional["_models.SqlUserDefinedFunctionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlUserDefinedFunctionGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -2336,10 +2434,10 @@ def begin_create_update_sql_user_defined_function( database_name, # type: str container_name, # type: str user_defined_function_name, # type: str - create_update_sql_user_defined_function_parameters, # type: "models.SqlUserDefinedFunctionCreateUpdateParameters" + create_update_sql_user_defined_function_parameters, # type: "_models.SqlUserDefinedFunctionCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.SqlUserDefinedFunctionGetResults"] + # type: (...) -> LROPoller["_models.SqlUserDefinedFunctionGetResults"] """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2366,7 +2464,7 @@ def begin_create_update_sql_user_defined_function( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlUserDefinedFunctionGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlUserDefinedFunctionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2394,7 +2492,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2423,7 +2530,7 @@ def _delete_sql_user_defined_function_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_user_defined_function_initial.metadata['url'] # type: ignore @@ -2514,7 +2621,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2536,7 +2652,7 @@ def list_sql_triggers( container_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.SqlTriggerListResult"] + # type: (...) -> Iterable["_models.SqlTriggerListResult"] """Lists the SQL trigger under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2552,12 +2668,12 @@ def list_sql_triggers( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlTriggerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlTriggerListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlTriggerListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -2620,7 +2736,7 @@ def get_sql_trigger( trigger_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.SqlTriggerGetResults" + # type: (...) -> "_models.SqlTriggerGetResults" """Gets the SQL trigger under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2638,12 +2754,12 @@ def get_sql_trigger( :rtype: ~azure.mgmt.cosmosdb.models.SqlTriggerGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlTriggerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlTriggerGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -2689,16 +2805,16 @@ def _create_update_sql_trigger_initial( database_name, # type: str container_name, # type: str trigger_name, # type: str - create_update_sql_trigger_parameters, # type: "models.SqlTriggerCreateUpdateParameters" + create_update_sql_trigger_parameters, # type: "_models.SqlTriggerCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.SqlTriggerGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SqlTriggerGetResults"]] + # type: (...) -> Optional["_models.SqlTriggerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlTriggerGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -2751,10 +2867,10 @@ def begin_create_update_sql_trigger( database_name, # type: str container_name, # type: str trigger_name, # type: str - create_update_sql_trigger_parameters, # type: "models.SqlTriggerCreateUpdateParameters" + create_update_sql_trigger_parameters, # type: "_models.SqlTriggerCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.SqlTriggerGetResults"] + # type: (...) -> LROPoller["_models.SqlTriggerGetResults"] """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2781,7 +2897,7 @@ def begin_create_update_sql_trigger( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SqlTriggerGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlTriggerGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2809,7 +2925,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2838,7 +2963,7 @@ def _delete_sql_trigger_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_sql_trigger_initial.metadata['url'] # type: ignore @@ -2929,7 +3054,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + '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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: 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 index ddaae7e52820..e2c4b74beb7a 100644 --- 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class TableResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def list_tables( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.TableListResult"] + # type: (...) -> Iterable["_models.TableListResult"] """Lists the Tables under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,12 +65,12 @@ def list_tables( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TableListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" def prepare_request(next_link=None): @@ -129,7 +129,7 @@ def get_table( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TableGetResults" + # type: (...) -> "_models.TableGetResults" """Gets the Tables under an existing Azure Cosmos DB database account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -143,12 +143,12 @@ def get_table( :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -190,16 +190,16 @@ def _create_update_table_initial( resource_group_name, # type: str account_name, # type: str table_name, # type: str - create_update_table_parameters, # type: "models.TableCreateUpdateParameters" + create_update_table_parameters, # type: "_models.TableCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.TableGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TableGetResults"]] + # type: (...) -> Optional["_models.TableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.TableGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -248,10 +248,10 @@ def begin_create_update_table( resource_group_name, # type: str account_name, # type: str table_name, # type: str - create_update_table_parameters, # type: "models.TableCreateUpdateParameters" + create_update_table_parameters, # type: "_models.TableCreateUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.TableGetResults"] + # type: (...) -> LROPoller["_models.TableGetResults"] """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -273,7 +273,7 @@ def begin_create_update_table( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.TableGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -299,7 +299,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,7 +333,7 @@ def _delete_table_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" # Construct URL url = self._delete_table_initial.metadata['url'] # type: ignore @@ -407,7 +414,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -428,7 +442,7 @@ def get_table_throughput( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ThroughputSettingsGetResults" + # type: (...) -> "_models.ThroughputSettingsGetResults" """Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. @@ -443,12 +457,12 @@ def get_table_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -490,16 +504,16 @@ def _update_table_throughput_initial( resource_group_name, # type: str account_name, # type: str table_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -548,10 +562,10 @@ def begin_update_table_throughput( resource_group_name, # type: str account_name, # type: str table_name, # type: str - update_throughput_parameters, # type: "models.ThroughputSettingsUpdateParameters" + update_throughput_parameters, # type: "_models.ThroughputSettingsUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -574,7 +588,7 @@ def begin_update_table_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -600,7 +614,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -621,13 +642,13 @@ def _migrate_table_to_autoscale_initial( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -654,7 +675,8 @@ def _migrate_table_to_autoscale_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -673,7 +695,7 @@ def begin_migrate_table_to_autoscale( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Table from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -693,7 +715,7 @@ def begin_migrate_table_to_autoscale( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -718,7 +740,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -739,13 +768,13 @@ def _migrate_table_to_manual_throughput_initial( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ThroughputSettingsGetResults"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ThroughputSettingsGetResults"]] + # type: (...) -> Optional["_models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01" + api_version = "2021-01-15" accept = "application/json" # Construct URL @@ -772,7 +801,8 @@ def _migrate_table_to_manual_throughput_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponseUpdatedFormat, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -791,7 +821,7 @@ def begin_migrate_table_to_manual_throughput( table_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ThroughputSettingsGetResults"] + # type: (...) -> LROPoller["_models.ThroughputSettingsGetResults"] """Migrate an Azure Cosmos DB Table from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -811,7 +841,7 @@ def begin_migrate_table_to_manual_throughput( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ThroughputSettingsGetResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -836,7 +866,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: