diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md index acbcd226fdb9..8eae8af20b65 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md +++ b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 7.0.0 (2022-07-22) + +**Features** + + - Added operation MongoDBResourcesOperations.begin_retrieve_continuous_backup_information + - Added operation group CassandraClustersOperations + - Added operation group CassandraDataCentersOperations + - Added operation group LocationsOperations + - Added operation group ServiceOperations + - Model DatabaseAccountCreateUpdateParameters has a new parameter capacity + - Model DatabaseAccountGetResults has a new parameter capacity + - Model DatabaseAccountUpdateParameters has a new parameter capacity + - Model GremlinGraphGetPropertiesResource has a new parameter analytical_storage_ttl + - Model GremlinGraphResource has a new parameter analytical_storage_ttl + - Model PeriodicModeProperties has a new parameter backup_storage_redundancy + ## 7.0.0b6 (2022-05-23) **Features** diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/MANIFEST.in b/sdk/cosmos/azure-mgmt-cosmosdb/MANIFEST.in index c0533d1d701f..185d35400c6f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/MANIFEST.in +++ b/sdk/cosmos/azure-mgmt-cosmosdb/MANIFEST.in @@ -1,5 +1,5 @@ include _meta.json -recursive-include tests *.py *.yaml +recursive-include tests *.py *.json include *.md include azure/__init__.py include azure/mgmt/__init__.py diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json b/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json index 32d151490ce0..a2a398e00938 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json +++ b/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.13.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "d916ae110aa385d49cd24787a05611345696644b", + "commit": "432872fac1d0f8edcae98a0e8504afc0ee302710", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/cosmos-db/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/cosmos-db/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --tag=package-2022-05 --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/cosmos-db/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py index 12e3ce0a66c7..174f63d0a3d9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['CosmosDBManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() 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 5b541c3eaa14..32c4cc4d5bcd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py @@ -29,8 +29,8 @@ class CosmosDBManagementClientConfiguration(Configuration): # pylint: disable=t :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-02-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-05-15". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,7 +41,7 @@ def __init__( **kwargs: Any ) -> None: super(CosmosDBManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', "2022-05-15") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 6999e90be6bc..eccf5646fe72 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 @@ -16,7 +16,7 @@ from . import models from ._configuration import CosmosDBManagementClientConfiguration -from .operations import CassandraClustersOperations, CassandraDataCentersOperations, CassandraResourcesOperations, CollectionOperations, CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, DataTransferJobsOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, GraphResourcesOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, NotebookWorkspacesOperations, Operations, PartitionKeyRangeIdOperations, PartitionKeyRangeIdRegionOperations, PercentileOperations, PercentileSourceTargetOperations, PercentileTargetOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RestorableDatabaseAccountsOperations, RestorableGremlinDatabasesOperations, RestorableGremlinGraphsOperations, RestorableGremlinResourcesOperations, RestorableMongodbCollectionsOperations, RestorableMongodbDatabasesOperations, RestorableMongodbResourcesOperations, RestorableSqlContainersOperations, RestorableSqlDatabasesOperations, RestorableSqlResourcesOperations, RestorableTableResourcesOperations, RestorableTablesOperations, ServiceOperations, SqlResourcesOperations, TableResourcesOperations +from .operations import CassandraClustersOperations, CassandraDataCentersOperations, CassandraResourcesOperations, CollectionOperations, CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, NotebookWorkspacesOperations, Operations, PartitionKeyRangeIdOperations, PartitionKeyRangeIdRegionOperations, PercentileOperations, PercentileSourceTargetOperations, PercentileTargetOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RestorableDatabaseAccountsOperations, RestorableMongodbCollectionsOperations, RestorableMongodbDatabasesOperations, RestorableMongodbResourcesOperations, RestorableSqlContainersOperations, RestorableSqlDatabasesOperations, RestorableSqlResourcesOperations, ServiceOperations, SqlResourcesOperations, TableResourcesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -55,8 +55,6 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attribute :ivar partition_key_range_id_region: PartitionKeyRangeIdRegionOperations operations :vartype partition_key_range_id_region: azure.mgmt.cosmosdb.operations.PartitionKeyRangeIdRegionOperations - :ivar graph_resources: GraphResourcesOperations operations - :vartype graph_resources: azure.mgmt.cosmosdb.operations.GraphResourcesOperations :ivar sql_resources: SqlResourcesOperations operations :vartype sql_resources: azure.mgmt.cosmosdb.operations.SqlResourcesOperations :ivar mongo_db_resources: MongoDBResourcesOperations operations @@ -69,8 +67,6 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attribute :vartype gremlin_resources: azure.mgmt.cosmosdb.operations.GremlinResourcesOperations :ivar locations: LocationsOperations operations :vartype locations: azure.mgmt.cosmosdb.operations.LocationsOperations - :ivar data_transfer_jobs: DataTransferJobsOperations operations - :vartype data_transfer_jobs: azure.mgmt.cosmosdb.operations.DataTransferJobsOperations :ivar cassandra_clusters: CassandraClustersOperations operations :vartype cassandra_clusters: azure.mgmt.cosmosdb.operations.CassandraClustersOperations :ivar cassandra_data_centers: CassandraDataCentersOperations operations @@ -103,20 +99,6 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attribute :ivar restorable_mongodb_resources: RestorableMongodbResourcesOperations operations :vartype restorable_mongodb_resources: azure.mgmt.cosmosdb.operations.RestorableMongodbResourcesOperations - :ivar restorable_gremlin_databases: RestorableGremlinDatabasesOperations operations - :vartype restorable_gremlin_databases: - azure.mgmt.cosmosdb.operations.RestorableGremlinDatabasesOperations - :ivar restorable_gremlin_graphs: RestorableGremlinGraphsOperations operations - :vartype restorable_gremlin_graphs: - azure.mgmt.cosmosdb.operations.RestorableGremlinGraphsOperations - :ivar restorable_gremlin_resources: RestorableGremlinResourcesOperations operations - :vartype restorable_gremlin_resources: - azure.mgmt.cosmosdb.operations.RestorableGremlinResourcesOperations - :ivar restorable_tables: RestorableTablesOperations operations - :vartype restorable_tables: azure.mgmt.cosmosdb.operations.RestorableTablesOperations - :ivar restorable_table_resources: RestorableTableResourcesOperations operations - :vartype restorable_table_resources: - azure.mgmt.cosmosdb.operations.RestorableTableResourcesOperations :ivar service: ServiceOperations operations :vartype service: azure.mgmt.cosmosdb.operations.ServiceOperations :param credential: Credential needed for the client to connect to Azure. @@ -125,8 +107,8 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attribute :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-02-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-05-15". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -146,45 +128,102 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.database_accounts = DatabaseAccountsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.database = DatabaseOperations(self._client, self._config, self._serialize, self._deserialize) - self.collection = CollectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.collection_region = CollectionRegionOperations(self._client, self._config, self._serialize, self._deserialize) - self.database_account_region = DatabaseAccountRegionOperations(self._client, self._config, self._serialize, self._deserialize) - self.percentile_source_target = PercentileSourceTargetOperations(self._client, self._config, self._serialize, self._deserialize) - self.percentile_target = PercentileTargetOperations(self._client, self._config, self._serialize, self._deserialize) - self.percentile = PercentileOperations(self._client, self._config, self._serialize, self._deserialize) - self.collection_partition_region = CollectionPartitionRegionOperations(self._client, self._config, self._serialize, self._deserialize) - self.collection_partition = CollectionPartitionOperations(self._client, self._config, self._serialize, self._deserialize) - self.partition_key_range_id = PartitionKeyRangeIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.partition_key_range_id_region = PartitionKeyRangeIdRegionOperations(self._client, self._config, self._serialize, self._deserialize) - self.graph_resources = GraphResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sql_resources = SqlResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.mongo_db_resources = MongoDBResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.table_resources = TableResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.cassandra_resources = CassandraResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.gremlin_resources = GremlinResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_transfer_jobs = DataTransferJobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.cassandra_clusters = CassandraClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.cassandra_data_centers = CassandraDataCentersOperations(self._client, self._config, self._serialize, self._deserialize) - self.notebook_workspaces = NotebookWorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_database_accounts = RestorableDatabaseAccountsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_sql_databases = RestorableSqlDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_sql_containers = RestorableSqlContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_sql_resources = RestorableSqlResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_mongodb_databases = RestorableMongodbDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_mongodb_collections = RestorableMongodbCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_mongodb_resources = RestorableMongodbResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_gremlin_databases = RestorableGremlinDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_gremlin_graphs = RestorableGremlinGraphsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_gremlin_resources = RestorableGremlinResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_tables = RestorableTablesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_table_resources = RestorableTableResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.database_accounts = DatabaseAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.database = DatabaseOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.collection = CollectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.collection_region = CollectionRegionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.database_account_region = DatabaseAccountRegionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.percentile_source_target = PercentileSourceTargetOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.percentile_target = PercentileTargetOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.percentile = PercentileOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.collection_partition_region = CollectionPartitionRegionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.collection_partition = CollectionPartitionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.partition_key_range_id = PartitionKeyRangeIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.partition_key_range_id_region = PartitionKeyRangeIdRegionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_resources = SqlResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mongo_db_resources = MongoDBResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.table_resources = TableResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cassandra_resources = CassandraResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gremlin_resources = GremlinResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.locations = LocationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cassandra_clusters = CassandraClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cassandra_data_centers = CassandraDataCentersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.notebook_workspaces = NotebookWorkspacesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_database_accounts = RestorableDatabaseAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_sql_databases = RestorableSqlDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_sql_containers = RestorableSqlContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_sql_resources = RestorableSqlResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_mongodb_databases = RestorableMongodbDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_mongodb_collections = RestorableMongodbCollectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_mongodb_resources = RestorableMongodbResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_metadata.json b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_metadata.json deleted file mode 100644 index 791b7ae26cdf..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_metadata.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "chosen_version": "2022-02-15-preview", - "total_api_version_list": ["2022-02-15-preview"], - "client": { - "name": "CosmosDBManagementClient", - "filename": "_cosmos_db_management_client", - "description": "Azure Cosmos DB Database Service Resource Provider REST API.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CosmosDBManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CosmosDBManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "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: \"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: str,", - "description": "The ID of the target subscription.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "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", - "graph_resources": "GraphResourcesOperations", - "sql_resources": "SqlResourcesOperations", - "mongo_db_resources": "MongoDBResourcesOperations", - "table_resources": "TableResourcesOperations", - "cassandra_resources": "CassandraResourcesOperations", - "gremlin_resources": "GremlinResourcesOperations", - "locations": "LocationsOperations", - "data_transfer_jobs": "DataTransferJobsOperations", - "cassandra_clusters": "CassandraClustersOperations", - "cassandra_data_centers": "CassandraDataCentersOperations", - "notebook_workspaces": "NotebookWorkspacesOperations", - "private_endpoint_connections": "PrivateEndpointConnectionsOperations", - "private_link_resources": "PrivateLinkResourcesOperations", - "restorable_database_accounts": "RestorableDatabaseAccountsOperations", - "restorable_sql_databases": "RestorableSqlDatabasesOperations", - "restorable_sql_containers": "RestorableSqlContainersOperations", - "restorable_sql_resources": "RestorableSqlResourcesOperations", - "restorable_mongodb_databases": "RestorableMongodbDatabasesOperations", - "restorable_mongodb_collections": "RestorableMongodbCollectionsOperations", - "restorable_mongodb_resources": "RestorableMongodbResourcesOperations", - "restorable_gremlin_databases": "RestorableGremlinDatabasesOperations", - "restorable_gremlin_graphs": "RestorableGremlinGraphsOperations", - "restorable_gremlin_resources": "RestorableGremlinResourcesOperations", - "restorable_tables": "RestorableTablesOperations", - "restorable_table_resources": "RestorableTableResourcesOperations", - "service": "ServiceOperations" - } -} \ 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 0ed662c82c43..364f3c906cf9 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 = "7.0.0b6" +VERSION = "7.0.0" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/__init__.py index 84d58edd389c..e5fc49b735f1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._cosmos_db_management_client import CosmosDBManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['CosmosDBManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() 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 3eb06ac6386a..59a954abfa20 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 @@ -29,8 +29,8 @@ class CosmosDBManagementClientConfiguration(Configuration): # pylint: disable=t :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-02-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-05-15". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,7 +41,7 @@ def __init__( **kwargs: Any ) -> None: super(CosmosDBManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', "2022-05-15") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 142ba8dd0a8d..ffa2011446c8 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 @@ -16,7 +16,7 @@ from .. import models from ._configuration import CosmosDBManagementClientConfiguration -from .operations import CassandraClustersOperations, CassandraDataCentersOperations, CassandraResourcesOperations, CollectionOperations, CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, DataTransferJobsOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, GraphResourcesOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, NotebookWorkspacesOperations, Operations, PartitionKeyRangeIdOperations, PartitionKeyRangeIdRegionOperations, PercentileOperations, PercentileSourceTargetOperations, PercentileTargetOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RestorableDatabaseAccountsOperations, RestorableGremlinDatabasesOperations, RestorableGremlinGraphsOperations, RestorableGremlinResourcesOperations, RestorableMongodbCollectionsOperations, RestorableMongodbDatabasesOperations, RestorableMongodbResourcesOperations, RestorableSqlContainersOperations, RestorableSqlDatabasesOperations, RestorableSqlResourcesOperations, RestorableTableResourcesOperations, RestorableTablesOperations, ServiceOperations, SqlResourcesOperations, TableResourcesOperations +from .operations import CassandraClustersOperations, CassandraDataCentersOperations, CassandraResourcesOperations, CollectionOperations, CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, NotebookWorkspacesOperations, Operations, PartitionKeyRangeIdOperations, PartitionKeyRangeIdRegionOperations, PercentileOperations, PercentileSourceTargetOperations, PercentileTargetOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RestorableDatabaseAccountsOperations, RestorableMongodbCollectionsOperations, RestorableMongodbDatabasesOperations, RestorableMongodbResourcesOperations, RestorableSqlContainersOperations, RestorableSqlDatabasesOperations, RestorableSqlResourcesOperations, ServiceOperations, SqlResourcesOperations, TableResourcesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -56,8 +56,6 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attribute :ivar partition_key_range_id_region: PartitionKeyRangeIdRegionOperations operations :vartype partition_key_range_id_region: azure.mgmt.cosmosdb.aio.operations.PartitionKeyRangeIdRegionOperations - :ivar graph_resources: GraphResourcesOperations operations - :vartype graph_resources: azure.mgmt.cosmosdb.aio.operations.GraphResourcesOperations :ivar sql_resources: SqlResourcesOperations operations :vartype sql_resources: azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations :ivar mongo_db_resources: MongoDBResourcesOperations operations @@ -70,8 +68,6 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attribute :vartype gremlin_resources: azure.mgmt.cosmosdb.aio.operations.GremlinResourcesOperations :ivar locations: LocationsOperations operations :vartype locations: azure.mgmt.cosmosdb.aio.operations.LocationsOperations - :ivar data_transfer_jobs: DataTransferJobsOperations operations - :vartype data_transfer_jobs: azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations :ivar cassandra_clusters: CassandraClustersOperations operations :vartype cassandra_clusters: azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations :ivar cassandra_data_centers: CassandraDataCentersOperations operations @@ -106,20 +102,6 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attribute :ivar restorable_mongodb_resources: RestorableMongodbResourcesOperations operations :vartype restorable_mongodb_resources: azure.mgmt.cosmosdb.aio.operations.RestorableMongodbResourcesOperations - :ivar restorable_gremlin_databases: RestorableGremlinDatabasesOperations operations - :vartype restorable_gremlin_databases: - azure.mgmt.cosmosdb.aio.operations.RestorableGremlinDatabasesOperations - :ivar restorable_gremlin_graphs: RestorableGremlinGraphsOperations operations - :vartype restorable_gremlin_graphs: - azure.mgmt.cosmosdb.aio.operations.RestorableGremlinGraphsOperations - :ivar restorable_gremlin_resources: RestorableGremlinResourcesOperations operations - :vartype restorable_gremlin_resources: - azure.mgmt.cosmosdb.aio.operations.RestorableGremlinResourcesOperations - :ivar restorable_tables: RestorableTablesOperations operations - :vartype restorable_tables: azure.mgmt.cosmosdb.aio.operations.RestorableTablesOperations - :ivar restorable_table_resources: RestorableTableResourcesOperations operations - :vartype restorable_table_resources: - azure.mgmt.cosmosdb.aio.operations.RestorableTableResourcesOperations :ivar service: ServiceOperations operations :vartype service: azure.mgmt.cosmosdb.aio.operations.ServiceOperations :param credential: Credential needed for the client to connect to Azure. @@ -128,8 +110,8 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attribute :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-02-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-05-15". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -149,45 +131,102 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.database_accounts = DatabaseAccountsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.database = DatabaseOperations(self._client, self._config, self._serialize, self._deserialize) - self.collection = CollectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.collection_region = CollectionRegionOperations(self._client, self._config, self._serialize, self._deserialize) - self.database_account_region = DatabaseAccountRegionOperations(self._client, self._config, self._serialize, self._deserialize) - self.percentile_source_target = PercentileSourceTargetOperations(self._client, self._config, self._serialize, self._deserialize) - self.percentile_target = PercentileTargetOperations(self._client, self._config, self._serialize, self._deserialize) - self.percentile = PercentileOperations(self._client, self._config, self._serialize, self._deserialize) - self.collection_partition_region = CollectionPartitionRegionOperations(self._client, self._config, self._serialize, self._deserialize) - self.collection_partition = CollectionPartitionOperations(self._client, self._config, self._serialize, self._deserialize) - self.partition_key_range_id = PartitionKeyRangeIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.partition_key_range_id_region = PartitionKeyRangeIdRegionOperations(self._client, self._config, self._serialize, self._deserialize) - self.graph_resources = GraphResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sql_resources = SqlResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.mongo_db_resources = MongoDBResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.table_resources = TableResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.cassandra_resources = CassandraResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.gremlin_resources = GremlinResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_transfer_jobs = DataTransferJobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.cassandra_clusters = CassandraClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.cassandra_data_centers = CassandraDataCentersOperations(self._client, self._config, self._serialize, self._deserialize) - self.notebook_workspaces = NotebookWorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_database_accounts = RestorableDatabaseAccountsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_sql_databases = RestorableSqlDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_sql_containers = RestorableSqlContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_sql_resources = RestorableSqlResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_mongodb_databases = RestorableMongodbDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_mongodb_collections = RestorableMongodbCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_mongodb_resources = RestorableMongodbResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_gremlin_databases = RestorableGremlinDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_gremlin_graphs = RestorableGremlinGraphsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_gremlin_resources = RestorableGremlinResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_tables = RestorableTablesOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_table_resources = RestorableTableResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.database_accounts = DatabaseAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.database = DatabaseOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.collection = CollectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.collection_region = CollectionRegionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.database_account_region = DatabaseAccountRegionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.percentile_source_target = PercentileSourceTargetOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.percentile_target = PercentileTargetOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.percentile = PercentileOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.collection_partition_region = CollectionPartitionRegionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.collection_partition = CollectionPartitionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.partition_key_range_id = PartitionKeyRangeIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.partition_key_range_id_region = PartitionKeyRangeIdRegionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_resources = SqlResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mongo_db_resources = MongoDBResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.table_resources = TableResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cassandra_resources = CassandraResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gremlin_resources = GremlinResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.locations = LocationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cassandra_clusters = CassandraClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cassandra_data_centers = CassandraDataCentersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.notebook_workspaces = NotebookWorkspacesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_database_accounts = RestorableDatabaseAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_sql_databases = RestorableSqlDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_sql_containers = RestorableSqlContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_sql_resources = RestorableSqlResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_mongodb_databases = RestorableMongodbDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_mongodb_collections = RestorableMongodbCollectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_mongodb_resources = RestorableMongodbResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/__init__.py index 5839e9432833..4dc3387907c0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/__init__.py @@ -19,14 +19,12 @@ from ._collection_partition_operations import CollectionPartitionOperations from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations -from ._graph_resources_operations import GraphResourcesOperations from ._sql_resources_operations import SqlResourcesOperations from ._mongo_db_resources_operations import MongoDBResourcesOperations from ._table_resources_operations import TableResourcesOperations from ._cassandra_resources_operations import CassandraResourcesOperations from ._gremlin_resources_operations import GremlinResourcesOperations from ._locations_operations import LocationsOperations -from ._data_transfer_jobs_operations import DataTransferJobsOperations from ._cassandra_clusters_operations import CassandraClustersOperations from ._cassandra_data_centers_operations import CassandraDataCentersOperations from ._notebook_workspaces_operations import NotebookWorkspacesOperations @@ -39,13 +37,11 @@ from ._restorable_mongodb_databases_operations import RestorableMongodbDatabasesOperations from ._restorable_mongodb_collections_operations import RestorableMongodbCollectionsOperations from ._restorable_mongodb_resources_operations import RestorableMongodbResourcesOperations -from ._restorable_gremlin_databases_operations import RestorableGremlinDatabasesOperations -from ._restorable_gremlin_graphs_operations import RestorableGremlinGraphsOperations -from ._restorable_gremlin_resources_operations import RestorableGremlinResourcesOperations -from ._restorable_tables_operations import RestorableTablesOperations -from ._restorable_table_resources_operations import RestorableTableResourcesOperations from ._service_operations import ServiceOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'DatabaseAccountsOperations', 'Operations', @@ -60,14 +56,12 @@ 'CollectionPartitionOperations', 'PartitionKeyRangeIdOperations', 'PartitionKeyRangeIdRegionOperations', - 'GraphResourcesOperations', 'SqlResourcesOperations', 'MongoDBResourcesOperations', 'TableResourcesOperations', 'CassandraResourcesOperations', 'GremlinResourcesOperations', 'LocationsOperations', - 'DataTransferJobsOperations', 'CassandraClustersOperations', 'CassandraDataCentersOperations', 'NotebookWorkspacesOperations', @@ -80,10 +74,7 @@ 'RestorableMongodbDatabasesOperations', 'RestorableMongodbCollectionsOperations', 'RestorableMongodbResourcesOperations', - 'RestorableGremlinDatabasesOperations', - 'RestorableGremlinGraphsOperations', - 'RestorableGremlinResourcesOperations', - 'RestorableTablesOperations', - 'RestorableTableResourcesOperations', 'ServiceOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_clusters_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_clusters_operations.py index e8496e939e17..9c5a8ef041ac 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_clusters_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_clusters_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,42 +16,41 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._cassandra_clusters_operations import build_create_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_get_backup_request, build_get_request, build_invoke_command_request_initial, build_list_backups_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_start_request_initial, build_status_request, build_update_request_initial +from ...operations._cassandra_clusters_operations import build_create_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_get_request, build_invoke_command_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_start_request_initial, build_status_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CassandraClustersOperations: - """CassandraClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`cassandra_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_subscription( self, **kwargs: Any - ) -> AsyncIterable["_models.ListClusters"]: + ) -> AsyncIterable[_models.ListClusters]: """List all managed Cassandra clusters in this subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -59,13 +58,16 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ListClusters] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ListClusters] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListClusters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -73,9 +75,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -83,9 +87,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -123,7 +129,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ListClusters"]: + ) -> AsyncIterable[_models.ListClusters]: """List all managed Cassandra clusters in this resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -133,13 +139,16 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ListClusters] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ListClusters] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListClusters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -159,9 +170,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -200,7 +213,7 @@ async def get( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ClusterResource": + ) -> _models.ClusterResource: """Get the properties of a managed Cassandra cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -212,13 +225,16 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.ClusterResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] request = build_get_request( @@ -227,11 +243,13 @@ async def get( cluster_name=cluster_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,13 +276,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -273,11 +294,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements cluster_name=cluster_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -319,20 +342,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -342,8 +370,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -360,17 +394,20 @@ async def _create_update_initial( self, resource_group_name: str, cluster_name: str, - body: "_models.ClusterResource", + body: _models.ClusterResource, **kwargs: Any - ) -> "_models.ClusterResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] + ) -> _models.ClusterResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] _json = self._serialize.body(body, 'ClusterResource') @@ -382,11 +419,13 @@ async def _create_update_initial( content_type=content_type, json=_json, template_url=self._create_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,9 +455,9 @@ async def begin_create_update( self, resource_group_name: str, cluster_name: str, - body: "_models.ClusterResource", + body: _models.ClusterResource, **kwargs: Any - ) -> AsyncLROPoller["_models.ClusterResource"]: + ) -> AsyncLROPoller[_models.ClusterResource]: """Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update only some properties, use PATCH. @@ -441,37 +480,47 @@ async def begin_create_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_initial( + raw_result = await self._create_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ClusterResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -488,17 +537,20 @@ async def _update_initial( self, resource_group_name: str, cluster_name: str, - body: "_models.ClusterResource", + body: _models.ClusterResource, **kwargs: Any - ) -> "_models.ClusterResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] + ) -> _models.ClusterResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] _json = self._serialize.body(body, 'ClusterResource') @@ -510,11 +562,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -544,9 +598,9 @@ async def begin_update( self, resource_group_name: str, cluster_name: str, - body: "_models.ClusterResource", + body: _models.ClusterResource, **kwargs: Any - ) -> AsyncLROPoller["_models.ClusterResource"]: + ) -> AsyncLROPoller[_models.ClusterResource]: """Updates some of the properties of a managed Cassandra cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -568,37 +622,47 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ClusterResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -615,17 +679,20 @@ async def _invoke_command_initial( self, resource_group_name: str, cluster_name: str, - body: "_models.CommandPostBody", + body: _models.CommandPostBody, **kwargs: Any - ) -> "_models.CommandOutput": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CommandOutput"] + ) -> _models.CommandOutput: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CommandOutput] _json = self._serialize.body(body, 'CommandPostBody') @@ -637,11 +704,13 @@ async def _invoke_command_initial( content_type=content_type, json=_json, template_url=self._invoke_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -667,9 +736,9 @@ async def begin_invoke_command( self, resource_group_name: str, cluster_name: str, - body: "_models.CommandPostBody", + body: _models.CommandPostBody, **kwargs: Any - ) -> AsyncLROPoller["_models.CommandOutput"]: + ) -> AsyncLROPoller[_models.CommandOutput]: """Invoke a command like nodetool for cassandra maintenance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -691,37 +760,47 @@ async def begin_invoke_command( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CommandOutput] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CommandOutput"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._invoke_command_initial( + raw_result = await self._invoke_command_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CommandOutput', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -734,162 +813,22 @@ def get_long_running_output(pipeline_response): begin_invoke_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand"} # type: ignore - @distributed_trace - def list_backups( - self, - resource_group_name: str, - cluster_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ListBackups"]: - """List the backups of this cluster that are available to restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBackups or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ListBackups] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBackups"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_backups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - cluster_name=cluster_name, - api_version=api_version, - template_url=self.list_backups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_backups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - cluster_name=cluster_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ListBackups", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_backups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups"} # type: ignore - - @distributed_trace_async - async def get_backup( - self, - resource_group_name: str, - cluster_name: str, - backup_id: str, - **kwargs: Any - ) -> "_models.BackupResource": - """Get the properties of an individual backup of this cluster that is available to restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. - :type cluster_name: str - :param backup_id: Id of a restorable backup of a Cassandra cluster. - :type backup_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResource, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.BackupResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_backup_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - cluster_name=cluster_name, - backup_id=backup_id, - api_version=api_version, - template_url=self.get_backup.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BackupResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_backup.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}"} # type: ignore - - async def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_deallocate_request_initial( @@ -898,11 +837,13 @@ async def _deallocate_initial( # pylint: disable=inconsistent-return-statements cluster_name=cluster_name, api_version=api_version, template_url=self._deallocate_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -946,20 +887,25 @@ async def begin_deallocate( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._deallocate_initial( + raw_result = await self._deallocate_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -969,8 +915,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -989,13 +941,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1004,11 +959,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements cluster_name=cluster_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1052,20 +1009,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1075,8 +1037,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1095,7 +1063,7 @@ async def status( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.CassandraClusterPublicStatus": + ) -> _models.CassandraClusterPublicStatus: """Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1107,13 +1075,16 @@ async def status( :rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraClusterPublicStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraClusterPublicStatus] request = build_status_request( @@ -1122,11 +1093,13 @@ async def status( cluster_name=cluster_name, api_version=api_version, template_url=self.status.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_data_centers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_data_centers_operations.py index e1c8bedf7b26..616ab7058f7f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_data_centers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_data_centers_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CassandraDataCentersOperations: - """CassandraDataCentersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`cassandra_data_centers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -53,7 +52,7 @@ def list( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ListDataCenters"]: + ) -> AsyncIterable[_models.ListDataCenters]: """List all data centers in a particular managed Cassandra cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,13 +64,16 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ListDataCenters] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ListDataCenters] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListDataCenters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -81,9 +83,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -93,9 +97,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -135,7 +141,7 @@ async def get( cluster_name: str, data_center_name: str, **kwargs: Any - ) -> "_models.DataCenterResource": + ) -> _models.DataCenterResource: """Get the properties of a managed Cassandra data center. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -149,13 +155,16 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] request = build_get_request( @@ -165,11 +174,13 @@ async def get( data_center_name=data_center_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -197,13 +208,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements data_center_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -213,11 +227,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements data_center_name=data_center_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -262,21 +278,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -286,8 +307,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -305,17 +332,20 @@ async def _create_update_initial( resource_group_name: str, cluster_name: str, data_center_name: str, - body: "_models.DataCenterResource", + body: _models.DataCenterResource, **kwargs: Any - ) -> "_models.DataCenterResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] + ) -> _models.DataCenterResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] _json = self._serialize.body(body, 'DataCenterResource') @@ -328,11 +358,13 @@ async def _create_update_initial( content_type=content_type, json=_json, template_url=self._create_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -363,9 +395,9 @@ async def begin_create_update( resource_group_name: str, cluster_name: str, data_center_name: str, - body: "_models.DataCenterResource", + body: _models.DataCenterResource, **kwargs: Any - ) -> AsyncLROPoller["_models.DataCenterResource"]: + ) -> AsyncLROPoller[_models.DataCenterResource]: """Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some properties, use PATCH. @@ -390,17 +422,20 @@ async def begin_create_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_initial( + raw_result = await self._create_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, @@ -408,20 +443,27 @@ async def begin_create_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DataCenterResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -439,17 +481,20 @@ async def _update_initial( resource_group_name: str, cluster_name: str, data_center_name: str, - body: "_models.DataCenterResource", + body: _models.DataCenterResource, **kwargs: Any - ) -> "_models.DataCenterResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] + ) -> _models.DataCenterResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] _json = self._serialize.body(body, 'DataCenterResource') @@ -462,11 +507,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -497,9 +544,9 @@ async def begin_update( resource_group_name: str, cluster_name: str, data_center_name: str, - body: "_models.DataCenterResource", + body: _models.DataCenterResource, **kwargs: Any - ) -> AsyncLROPoller["_models.DataCenterResource"]: + ) -> AsyncLROPoller[_models.DataCenterResource]: """Update some of the properties of a managed Cassandra data center. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -523,17 +570,20 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, @@ -541,20 +591,27 @@ async def begin_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DataCenterResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( 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 fd03d9a197ac..c966792c36b2 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,35 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._cassandra_resources_operations import build_create_update_cassandra_keyspace_request_initial, build_create_update_cassandra_table_request_initial, build_create_update_cassandra_view_request_initial, build_delete_cassandra_keyspace_request_initial, build_delete_cassandra_table_request_initial, build_delete_cassandra_view_request_initial, build_get_cassandra_keyspace_request, build_get_cassandra_keyspace_throughput_request, build_get_cassandra_table_request, build_get_cassandra_table_throughput_request, build_get_cassandra_view_request, build_get_cassandra_view_throughput_request, build_list_cassandra_keyspaces_request, build_list_cassandra_tables_request, build_list_cassandra_views_request, build_migrate_cassandra_keyspace_to_autoscale_request_initial, build_migrate_cassandra_keyspace_to_manual_throughput_request_initial, build_migrate_cassandra_table_to_autoscale_request_initial, build_migrate_cassandra_table_to_manual_throughput_request_initial, build_migrate_cassandra_view_to_autoscale_request_initial, build_migrate_cassandra_view_to_manual_throughput_request_initial, build_update_cassandra_keyspace_throughput_request_initial, build_update_cassandra_table_throughput_request_initial, build_update_cassandra_view_throughput_request_initial +from ...operations._cassandra_resources_operations import build_create_update_cassandra_keyspace_request_initial, build_create_update_cassandra_table_request_initial, build_delete_cassandra_keyspace_request_initial, build_delete_cassandra_table_request_initial, build_get_cassandra_keyspace_request, build_get_cassandra_keyspace_throughput_request, build_get_cassandra_table_request, build_get_cassandra_table_throughput_request, build_list_cassandra_keyspaces_request, build_list_cassandra_tables_request, build_migrate_cassandra_keyspace_to_autoscale_request_initial, build_migrate_cassandra_keyspace_to_manual_throughput_request_initial, build_migrate_cassandra_table_to_autoscale_request_initial, build_migrate_cassandra_table_to_manual_throughput_request_initial, build_update_cassandra_keyspace_throughput_request_initial, build_update_cassandra_table_throughput_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CassandraResourcesOperations: # pylint: disable=too-many-public-methods - """CassandraResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`cassandra_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_cassandra_keyspaces( @@ -53,7 +52,7 @@ def list_cassandra_keyspaces( resource_group_name: str, account_name: str, **kwargs: Any - ) -> 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. @@ -67,13 +66,16 @@ def list_cassandra_keyspaces( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_cassandra_keyspaces.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get_cassandra_keyspace( account_name: str, keyspace_name: str, **kwargs: Any - ) -> "_models.CassandraKeyspaceGetResults": + ) -> _models.CassandraKeyspaceGetResults: """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. @@ -152,13 +158,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraKeyspaceGetResults] request = build_get_cassandra_keyspace_request( @@ -168,11 +177,13 @@ async def get_cassandra_keyspace( keyspace_name=keyspace_name, api_version=api_version, template_url=self.get_cassandra_keyspace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -198,17 +209,20 @@ 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: Any - ) -> Optional["_models.CassandraKeyspaceGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CassandraKeyspaceGetResults"]] + ) -> Optional[_models.CassandraKeyspaceGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.CassandraKeyspaceGetResults]] _json = self._serialize.body(create_update_cassandra_keyspace_parameters, 'CassandraKeyspaceCreateUpdateParameters') @@ -221,11 +235,13 @@ async def _create_update_cassandra_keyspace_initial( content_type=content_type, json=_json, template_url=self._create_update_cassandra_keyspace_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -254,9 +270,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: Any - ) -> 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. @@ -283,17 +299,20 @@ async def begin_create_update_cassandra_keyspace( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraKeyspaceGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraKeyspaceGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_cassandra_keyspace_initial( + raw_result = await self._create_update_cassandra_keyspace_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -301,20 +320,27 @@ async def begin_create_update_cassandra_keyspace( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CassandraKeyspaceGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -334,13 +360,16 @@ async def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-re keyspace_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_cassandra_keyspace_request_initial( @@ -350,11 +379,13 @@ async def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-re keyspace_name=keyspace_name, api_version=api_version, template_url=self._delete_cassandra_keyspace_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -399,21 +430,26 @@ async def begin_delete_cassandra_keyspace( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_cassandra_keyspace_initial( + raw_result = await self._delete_cassandra_keyspace_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -423,8 +459,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -444,7 +486,7 @@ async def get_cassandra_keyspace_throughput( account_name: str, keyspace_name: str, **kwargs: Any - ) -> "_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. @@ -459,13 +501,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_cassandra_keyspace_throughput_request( @@ -475,11 +520,13 @@ async def get_cassandra_keyspace_throughput( keyspace_name=keyspace_name, api_version=api_version, template_url=self.get_cassandra_keyspace_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -505,17 +552,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -528,11 +578,13 @@ async def _update_cassandra_keyspace_throughput_initial( content_type=content_type, json=_json, template_url=self._update_cassandra_keyspace_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -561,9 +613,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: Any - ) -> 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. @@ -590,17 +642,20 @@ async def begin_update_cassandra_keyspace_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_cassandra_keyspace_throughput_initial( + raw_result = await self._update_cassandra_keyspace_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -608,20 +663,27 @@ async def begin_update_cassandra_keyspace_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -640,14 +702,17 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( account_name: str, keyspace_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_cassandra_keyspace_to_autoscale_request_initial( @@ -657,11 +722,13 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( keyspace_name=keyspace_name, api_version=api_version, template_url=self._migrate_cassandra_keyspace_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -691,7 +758,7 @@ async def begin_migrate_cassandra_keyspace_to_autoscale( account_name: str, keyspace_name: str, **kwargs: Any - ) -> 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. @@ -714,35 +781,45 @@ async def begin_migrate_cassandra_keyspace_to_autoscale( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_cassandra_keyspace_to_autoscale_initial( + raw_result = await self._migrate_cassandra_keyspace_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -761,14 +838,17 @@ async def _migrate_cassandra_keyspace_to_manual_throughput_initial( account_name: str, keyspace_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_cassandra_keyspace_to_manual_throughput_request_initial( @@ -778,11 +858,13 @@ async def _migrate_cassandra_keyspace_to_manual_throughput_initial( keyspace_name=keyspace_name, api_version=api_version, template_url=self._migrate_cassandra_keyspace_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -812,7 +894,7 @@ async def begin_migrate_cassandra_keyspace_to_manual_throughput( account_name: str, keyspace_name: str, **kwargs: Any - ) -> 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. @@ -835,35 +917,45 @@ async def begin_migrate_cassandra_keyspace_to_manual_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_cassandra_keyspace_to_manual_throughput_initial( + raw_result = await self._migrate_cassandra_keyspace_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -883,7 +975,7 @@ def list_cassandra_tables( account_name: str, keyspace_name: str, **kwargs: Any - ) -> 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. @@ -899,13 +991,16 @@ def list_cassandra_tables( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -916,9 +1011,11 @@ def prepare_request(next_link=None): keyspace_name=keyspace_name, api_version=api_version, template_url=self.list_cassandra_tables.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -929,9 +1026,11 @@ def prepare_request(next_link=None): keyspace_name=keyspace_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -972,7 +1071,7 @@ async def get_cassandra_table( keyspace_name: str, table_name: str, **kwargs: Any - ) -> "_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. @@ -988,13 +1087,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraTableGetResults] request = build_get_cassandra_table_request( @@ -1005,11 +1107,13 @@ async def get_cassandra_table( table_name=table_name, api_version=api_version, template_url=self.get_cassandra_table.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1036,17 +1140,20 @@ 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: Any - ) -> Optional["_models.CassandraTableGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CassandraTableGetResults"]] + ) -> Optional[_models.CassandraTableGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.CassandraTableGetResults]] _json = self._serialize.body(create_update_cassandra_table_parameters, 'CassandraTableCreateUpdateParameters') @@ -1060,11 +1167,13 @@ async def _create_update_cassandra_table_initial( content_type=content_type, json=_json, template_url=self._create_update_cassandra_table_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1094,9 +1203,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: Any - ) -> 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. @@ -1125,17 +1234,20 @@ async def begin_create_update_cassandra_table( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraTableGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraTableGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_cassandra_table_initial( + raw_result = await self._create_update_cassandra_table_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -1144,20 +1256,27 @@ async def begin_create_update_cassandra_table( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CassandraTableGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1178,13 +1297,16 @@ async def _delete_cassandra_table_initial( # pylint: disable=inconsistent-retur table_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_cassandra_table_request_initial( @@ -1195,11 +1317,13 @@ async def _delete_cassandra_table_initial( # pylint: disable=inconsistent-retur table_name=table_name, api_version=api_version, template_url=self._delete_cassandra_table_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1247,22 +1371,27 @@ async def begin_delete_cassandra_table( # pylint: disable=inconsistent-return-s :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_cassandra_table_initial( + raw_result = await self._delete_cassandra_table_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1272,8 +1401,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1294,7 +1429,7 @@ async def get_cassandra_table_throughput( keyspace_name: str, table_name: str, **kwargs: Any - ) -> "_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. @@ -1311,13 +1446,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_cassandra_table_throughput_request( @@ -1328,11 +1466,13 @@ async def get_cassandra_table_throughput( table_name=table_name, api_version=api_version, template_url=self.get_cassandra_table_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1359,17 +1499,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -1383,11 +1526,13 @@ async def _update_cassandra_table_throughput_initial( content_type=content_type, json=_json, template_url=self._update_cassandra_table_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1417,9 +1562,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: Any - ) -> 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. @@ -1448,17 +1593,20 @@ async def begin_update_cassandra_table_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_cassandra_table_throughput_initial( + raw_result = await self._update_cassandra_table_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -1467,20 +1615,27 @@ async def begin_update_cassandra_table_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1500,14 +1655,17 @@ async def _migrate_cassandra_table_to_autoscale_initial( keyspace_name: str, table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_cassandra_table_to_autoscale_request_initial( @@ -1518,11 +1676,13 @@ async def _migrate_cassandra_table_to_autoscale_initial( table_name=table_name, api_version=api_version, template_url=self._migrate_cassandra_table_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1553,7 +1713,7 @@ async def begin_migrate_cassandra_table_to_autoscale( keyspace_name: str, table_name: str, **kwargs: Any - ) -> 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. @@ -1578,36 +1738,46 @@ async def begin_migrate_cassandra_table_to_autoscale( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_cassandra_table_to_autoscale_initial( + raw_result = await self._migrate_cassandra_table_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1627,14 +1797,17 @@ async def _migrate_cassandra_table_to_manual_throughput_initial( keyspace_name: str, table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_cassandra_table_to_manual_throughput_request_initial( @@ -1645,11 +1818,13 @@ async def _migrate_cassandra_table_to_manual_throughput_initial( table_name=table_name, api_version=api_version, template_url=self._migrate_cassandra_table_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1680,7 +1855,7 @@ async def begin_migrate_cassandra_table_to_manual_throughput( keyspace_name: str, table_name: str, **kwargs: Any - ) -> 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. @@ -1705,36 +1880,46 @@ async def begin_migrate_cassandra_table_to_manual_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_cassandra_table_to_manual_throughput_initial( + raw_result = await self._migrate_cassandra_table_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1746,873 +1931,3 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_migrate_cassandra_table_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - @distributed_trace - def list_cassandra_views( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.CassandraViewListResult"]: - """Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CassandraViewListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraViewListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_cassandra_views_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - template_url=self.list_cassandra_views.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_cassandra_views_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CassandraViewListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_cassandra_views.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views"} # type: ignore - - @distributed_trace_async - async def get_cassandra_view( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any - ) -> "_models.CassandraViewGetResults": - """Gets the Cassandra view under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CassandraViewGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraViewGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_cassandra_view_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - template_url=self.get_cassandra_view.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CassandraViewGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_cassandra_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - - async def _create_update_cassandra_view_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: "_models.CassandraViewCreateUpdateParameters", - **kwargs: Any - ) -> Optional["_models.CassandraViewGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CassandraViewGetResults"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(create_update_cassandra_view_parameters, 'CassandraViewCreateUpdateParameters') - - request = build_create_update_cassandra_view_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_update_cassandra_view_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CassandraViewGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_cassandra_view_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_update_cassandra_view( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: "_models.CassandraViewCreateUpdateParameters", - **kwargs: Any - ) -> AsyncLROPoller["_models.CassandraViewGetResults"]: - """Create or update an Azure Cosmos DB Cassandra View. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str - :param create_update_cassandra_view_parameters: The parameters to provide for the current - Cassandra View. - :type create_update_cassandra_view_parameters: - ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 CassandraViewGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraViewGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_update_cassandra_view_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - create_update_cassandra_view_parameters=create_update_cassandra_view_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CassandraViewGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_cassandra_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - async def _delete_cassandra_view_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_delete_cassandra_view_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - template_url=self._delete_cassandra_view_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_cassandra_view_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete_cassandra_view( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra view. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_cassandra_view_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_cassandra_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - @distributed_trace_async - async def get_cassandra_view_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": - """Gets the RUs per second of the Cassandra view 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ThroughputSettingsGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_cassandra_view_throughput_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - template_url=self.get_cassandra_view_throughput.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_cassandra_view_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore - - - async def _update_cassandra_view_throughput_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') - - request = build_update_cassandra_view_throughput_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_cassandra_view_throughput_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_cassandra_view_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_cassandra_view_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", - **kwargs: Any - ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: - """Update RUs per second of an Azure Cosmos DB Cassandra view. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra view. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_cassandra_view_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - update_throughput_parameters=update_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_cassandra_view_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore - - async def _migrate_cassandra_view_to_autoscale_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_migrate_cassandra_view_to_autoscale_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - template_url=self._migrate_cassandra_view_to_autoscale_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_cassandra_view_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - - @distributed_trace_async - async def begin_migrate_cassandra_view_to_autoscale( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._migrate_cassandra_view_to_autoscale_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_cassandra_view_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - async def _migrate_cassandra_view_to_manual_throughput_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_migrate_cassandra_view_to_manual_throughput_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - template_url=self._migrate_cassandra_view_to_manual_throughput_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_cassandra_view_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - - @distributed_trace_async - async def begin_migrate_cassandra_view_to_manual_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._migrate_cassandra_view_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_cassandra_view_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore 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 be651514effe..34b489d5e196 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CollectionOperations: - """CollectionOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`collection` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -53,7 +52,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs: Any - ) -> AsyncIterable["_models.MetricListResult"]: + ) -> AsyncIterable[_models.MetricListResult]: """Retrieves the metrics determined by the given filter for the given database account and collection. @@ -74,13 +73,16 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -93,9 +95,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -108,9 +112,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -152,7 +158,7 @@ def list_usages( collection_rid: str, filter: Optional[str] = None, **kwargs: Any - ) -> 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. @@ -172,13 +178,16 @@ def list_usages( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -191,9 +200,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -206,9 +217,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -249,7 +262,7 @@ def list_metric_definitions( database_rid: str, collection_rid: str, **kwargs: Any - ) -> 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. @@ -267,13 +280,16 @@ def list_metric_definitions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -285,9 +301,11 @@ def prepare_request(next_link=None): collection_rid=collection_rid, api_version=api_version, template_url=self.list_metric_definitions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -299,9 +317,11 @@ def prepare_request(next_link=None): collection_rid=collection_rid, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 4565f338b7a6..af6b115c3cdf 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CollectionPartitionOperations: - """CollectionPartitionOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`collection_partition` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -53,7 +52,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs: Any - ) -> AsyncIterable["_models.PartitionMetricListResult"]: + ) -> AsyncIterable[_models.PartitionMetricListResult]: """Retrieves the metrics determined by the given filter for the given collection, split by partition. @@ -76,13 +75,16 @@ def list_metrics( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -95,9 +97,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -110,9 +114,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -154,7 +160,7 @@ def list_usages( collection_rid: str, filter: Optional[str] = None, **kwargs: Any - ) -> 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. @@ -176,13 +182,16 @@ def list_usages( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -195,9 +204,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -210,9 +221,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 c305bed78590..99e377cbe46a 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CollectionPartitionRegionOperations: - """CollectionPartitionRegionOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`collection_partition_region` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -54,7 +53,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs: Any - ) -> AsyncIterable["_models.PartitionMetricListResult"]: + ) -> AsyncIterable[_models.PartitionMetricListResult]: """Retrieves the metrics determined by the given filter for the given collection and region, split by partition. @@ -79,13 +78,16 @@ def list_metrics( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -99,9 +101,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -115,9 +119,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 701766c18ef3..a21a4a4000c9 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CollectionRegionOperations: - """CollectionRegionOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`collection_region` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -54,7 +53,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs: Any - ) -> AsyncIterable["_models.MetricListResult"]: + ) -> AsyncIterable[_models.MetricListResult]: """Retrieves the metrics determined by the given filter for the given database account, collection and region. @@ -77,13 +76,16 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -97,9 +99,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -113,9 +117,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_data_transfer_jobs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_data_transfer_jobs_operations.py deleted file mode 100644 index d34d5e055868..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_data_transfer_jobs_operations.py +++ /dev/null @@ -1,446 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._data_transfer_jobs_operations import build_cancel_request, build_create_request, build_get_request, build_list_by_database_account_request, build_pause_request, build_resume_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DataTransferJobsOperations: - """DataTransferJobsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - account_name: str, - job_name: str, - job_create_parameters: "_models.CreateJobRequest", - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Creates a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :param job_create_parameters: - :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(job_create_parameters, 'CreateJobRequest') - - request = build_create_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}"} # type: ignore - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Get a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}"} # type: ignore - - - @distributed_trace_async - async def pause( - self, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Pause a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_pause_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - template_url=self.pause.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - pause.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/pause"} # type: ignore - - - @distributed_trace_async - async def resume( - self, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Resumes a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_resume_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - template_url=self.resume.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - resume.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/resume"} # type: ignore - - - @distributed_trace_async - async def cancel( - self, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Cancels a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_cancel_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - template_url=self.cancel.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/cancel"} # type: ignore - - - @distributed_trace - def list_by_database_account( - self, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.DataTransferJobFeedResults"]: - """Get a list of Data Transfer jobs. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataTransferJobFeedResults or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobFeedResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobFeedResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_database_account_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.list_by_database_account.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_database_account_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DataTransferJobFeedResults", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_database_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs"} # type: ignore 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 76da679520d7..9897668baa93 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DatabaseAccountRegionOperations: - """DatabaseAccountRegionOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`database_account_region` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -52,7 +51,7 @@ def list_metrics( region: str, filter: str, **kwargs: Any - ) -> 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. @@ -70,13 +69,16 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -88,9 +90,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -102,9 +106,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 ab5002e2638d..aa67a81f70f8 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods - """DatabaseAccountsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`database_accounts` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get( @@ -53,7 +52,7 @@ async def get( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -65,13 +64,16 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] request = build_get_request( @@ -80,11 +82,13 @@ async def get( account_name=account_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -109,17 +113,20 @@ async def _update_initial( self, resource_group_name: str, account_name: str, - update_parameters: "_models.DatabaseAccountUpdateParameters", + update_parameters: _models.DatabaseAccountUpdateParameters, **kwargs: Any - ) -> "_models.DatabaseAccountGetResults": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] + ) -> _models.DatabaseAccountGetResults: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] _json = self._serialize.body(update_parameters, 'DatabaseAccountUpdateParameters') @@ -131,11 +138,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -161,9 +170,9 @@ async def begin_update( self, resource_group_name: str, account_name: str, - update_parameters: "_models.DatabaseAccountUpdateParameters", + update_parameters: _models.DatabaseAccountUpdateParameters, **kwargs: Any - ) -> 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. @@ -186,37 +195,47 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, update_parameters=update_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DatabaseAccountGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -233,17 +252,20 @@ 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: Any - ) -> "_models.DatabaseAccountGetResults": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] + ) -> _models.DatabaseAccountGetResults: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] _json = self._serialize.body(create_update_parameters, 'DatabaseAccountCreateUpdateParameters') @@ -255,11 +277,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -285,9 +309,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: Any - ) -> 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. @@ -312,37 +336,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, create_update_parameters=create_update_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DatabaseAccountGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -361,13 +395,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements account_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -376,11 +413,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements account_name=account_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -422,20 +461,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -445,8 +489,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -463,17 +513,20 @@ async def _failover_priority_change_initial( # pylint: disable=inconsistent-ret self, resource_group_name: str, account_name: str, - failover_parameters: "_models.FailoverPolicies", + failover_parameters: _models.FailoverPolicies, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(failover_parameters, 'FailoverPolicies') @@ -485,11 +538,13 @@ async def _failover_priority_change_initial( # pylint: disable=inconsistent-ret content_type=content_type, json=_json, template_url=self._failover_priority_change_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -511,7 +566,7 @@ async def begin_failover_priority_change( # pylint: disable=inconsistent-return self, resource_group_name: str, account_name: str, - failover_parameters: "_models.FailoverPolicies", + failover_parameters: _models.FailoverPolicies, **kwargs: Any ) -> AsyncLROPoller[None]: """Changes the failover priority for the Azure Cosmos DB database account. A failover priority of @@ -537,23 +592,28 @@ async def begin_failover_priority_change( # pylint: disable=inconsistent-return :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._failover_priority_change_initial( + raw_result = await self._failover_priority_change_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, failover_parameters=failover_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -563,8 +623,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -581,7 +647,7 @@ def get_long_running_output(pipeline_response): def list( self, **kwargs: Any - ) -> 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 @@ -591,13 +657,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -605,9 +674,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -615,9 +686,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -655,7 +728,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> 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. @@ -667,13 +740,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -682,9 +758,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -693,9 +771,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -734,7 +814,7 @@ async def list_keys( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -746,13 +826,16 @@ async def list_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountListKeysResult] request = build_list_keys_request( @@ -761,11 +844,13 @@ async def list_keys( account_name=account_name, api_version=api_version, template_url=self.list_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -792,7 +877,7 @@ async def list_connection_strings( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -804,13 +889,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountListConnectionStringsResult] request = build_list_connection_strings_request( @@ -819,11 +907,13 @@ async def list_connection_strings( account_name=account_name, api_version=api_version, template_url=self.list_connection_strings.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -848,17 +938,20 @@ async def _offline_region_initial( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, account_name: str, - region_parameter_for_offline: "_models.RegionForOnlineOffline", + region_parameter_for_offline: _models.RegionForOnlineOffline, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(region_parameter_for_offline, 'RegionForOnlineOffline') @@ -870,11 +963,13 @@ async def _offline_region_initial( # pylint: disable=inconsistent-return-statem content_type=content_type, json=_json, template_url=self._offline_region_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -896,7 +991,7 @@ async def begin_offline_region( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, account_name: str, - region_parameter_for_offline: "_models.RegionForOnlineOffline", + region_parameter_for_offline: _models.RegionForOnlineOffline, **kwargs: Any ) -> AsyncLROPoller[None]: """Offline the specified region for the specified Azure Cosmos DB database account. @@ -919,23 +1014,28 @@ async def begin_offline_region( # pylint: disable=inconsistent-return-statement :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._offline_region_initial( + raw_result = await self._offline_region_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, region_parameter_for_offline=region_parameter_for_offline, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -945,8 +1045,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -963,17 +1069,20 @@ async def _online_region_initial( # pylint: disable=inconsistent-return-stateme self, resource_group_name: str, account_name: str, - region_parameter_for_online: "_models.RegionForOnlineOffline", + region_parameter_for_online: _models.RegionForOnlineOffline, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(region_parameter_for_online, 'RegionForOnlineOffline') @@ -985,11 +1094,13 @@ async def _online_region_initial( # pylint: disable=inconsistent-return-stateme content_type=content_type, json=_json, template_url=self._online_region_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1011,7 +1122,7 @@ async def begin_online_region( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, - region_parameter_for_online: "_models.RegionForOnlineOffline", + region_parameter_for_online: _models.RegionForOnlineOffline, **kwargs: Any ) -> AsyncLROPoller[None]: """Online the specified region for the specified Azure Cosmos DB database account. @@ -1034,23 +1145,28 @@ async def begin_online_region( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._online_region_initial( + raw_result = await self._online_region_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, region_parameter_for_online=region_parameter_for_online, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1060,8 +1176,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1080,7 +1202,7 @@ async def get_read_only_keys( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -1092,13 +1214,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] request = build_get_read_only_keys_request( @@ -1107,11 +1232,13 @@ async def get_read_only_keys( account_name=account_name, api_version=api_version, template_url=self.get_read_only_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1138,7 +1265,7 @@ async def list_read_only_keys( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -1150,13 +1277,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] request = build_list_read_only_keys_request( @@ -1165,11 +1295,13 @@ async def list_read_only_keys( account_name=account_name, api_version=api_version, template_url=self.list_read_only_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1194,17 +1326,20 @@ async def _regenerate_key_initial( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, account_name: str, - key_to_regenerate: "_models.DatabaseAccountRegenerateKeyParameters", + key_to_regenerate: _models.DatabaseAccountRegenerateKeyParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(key_to_regenerate, 'DatabaseAccountRegenerateKeyParameters') @@ -1216,11 +1351,13 @@ async def _regenerate_key_initial( # pylint: disable=inconsistent-return-statem content_type=content_type, json=_json, template_url=self._regenerate_key_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1242,7 +1379,7 @@ async def begin_regenerate_key( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, account_name: str, - key_to_regenerate: "_models.DatabaseAccountRegenerateKeyParameters", + key_to_regenerate: _models.DatabaseAccountRegenerateKeyParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Regenerates an access key for the specified Azure Cosmos DB database account. @@ -1265,23 +1402,28 @@ async def begin_regenerate_key( # pylint: disable=inconsistent-return-statement :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._regenerate_key_initial( + raw_result = await self._regenerate_key_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, key_to_regenerate=key_to_regenerate, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1291,8 +1433,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1322,24 +1470,29 @@ async def check_name_exists( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_check_name_exists_request( account_name=account_name, api_version=api_version, template_url=self.check_name_exists.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1364,7 +1517,7 @@ def list_metrics( account_name: str, filter: str, **kwargs: Any - ) -> 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. @@ -1380,13 +1533,16 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1397,9 +1553,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1410,9 +1568,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1452,7 +1612,7 @@ def list_usages( account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> 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. @@ -1468,13 +1628,16 @@ def list_usages( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1485,9 +1648,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1498,9 +1663,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1539,7 +1706,7 @@ def list_metric_definitions( resource_group_name: str, account_name: str, **kwargs: Any - ) -> 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. @@ -1553,13 +1720,16 @@ def list_metric_definitions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1569,9 +1739,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_metric_definitions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1581,9 +1753,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 1d2851e68cff..6a1bf22f30e8 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DatabaseOperations: - """DatabaseOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`database` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -52,7 +51,7 @@ def list_metrics( database_rid: str, filter: str, **kwargs: Any - ) -> AsyncIterable["_models.MetricListResult"]: + ) -> AsyncIterable[_models.MetricListResult]: """Retrieves the metrics determined by the given filter for the given database account and database. @@ -71,13 +70,16 @@ def list_metrics( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -89,9 +91,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -103,9 +107,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -146,7 +152,7 @@ def list_usages( database_rid: str, filter: Optional[str] = None, **kwargs: Any - ) -> 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. @@ -164,13 +170,16 @@ def list_usages( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -182,9 +191,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -196,9 +207,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -238,7 +251,7 @@ def list_metric_definitions( account_name: str, database_rid: str, **kwargs: Any - ) -> 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. @@ -254,13 +267,16 @@ def list_metric_definitions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -271,9 +287,11 @@ def prepare_request(next_link=None): database_rid=database_rid, api_version=api_version, template_url=self.list_metric_definitions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -284,9 +302,11 @@ def prepare_request(next_link=None): database_rid=database_rid, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_graph_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_graph_resources_operations.py deleted file mode 100644 index f3e63dc5cd8a..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_graph_resources_operations.py +++ /dev/null @@ -1,436 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._graph_resources_operations import build_create_update_graph_request_initial, build_delete_graph_resource_request_initial, build_get_graph_request, build_list_graphs_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class GraphResourcesOperations: - """GraphResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_graphs( - self, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.GraphResourcesListResult"]: - """Lists the graphs under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GraphResourcesListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GraphResourcesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.GraphResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_graphs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.list_graphs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_graphs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GraphResourcesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_graphs.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs"} # type: ignore - - @distributed_trace_async - async def get_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - **kwargs: Any - ) -> "_models.GraphResourceGetResults": - """Gets the Graph resource 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. - :type graph_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GraphResourceGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.GraphResourceGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GraphResourceGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_graph_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - template_url=self.get_graph.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GraphResourceGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_graph.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - - async def _create_update_graph_initial( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: "_models.GraphResourceCreateUpdateParameters", - **kwargs: Any - ) -> Optional["_models.GraphResourceGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GraphResourceGetResults"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(create_update_graph_parameters, 'GraphResourceCreateUpdateParameters') - - request = build_create_update_graph_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_update_graph_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('GraphResourceGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_graph_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_update_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: "_models.GraphResourceCreateUpdateParameters", - **kwargs: Any - ) -> AsyncLROPoller["_models.GraphResourceGetResults"]: - """Create or update an Azure Cosmos DB Graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. - :type graph_name: str - :param create_update_graph_parameters: The parameters to provide for the current graph. - :type create_update_graph_parameters: - ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 GraphResourceGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GraphResourceGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_update_graph_initial( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - create_update_graph_parameters=create_update_graph_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('GraphResourceGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_graph.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - async def _delete_graph_resource_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - graph_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_delete_graph_resource_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - template_url=self._delete_graph_resource_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_graph_resource_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete_graph_resource( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - graph_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Graph Resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. - :type graph_name: str - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_graph_resource_initial( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_graph_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore 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 9a886f88eca6..f9e028cdbdf8 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,35 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._gremlin_resources_operations import build_create_update_gremlin_database_request_initial, build_create_update_gremlin_graph_request_initial, build_delete_gremlin_database_request_initial, build_delete_gremlin_graph_request_initial, build_get_gremlin_database_request, build_get_gremlin_database_throughput_request, build_get_gremlin_graph_request, build_get_gremlin_graph_throughput_request, build_list_gremlin_databases_request, build_list_gremlin_graphs_request, build_migrate_gremlin_database_to_autoscale_request_initial, build_migrate_gremlin_database_to_manual_throughput_request_initial, build_migrate_gremlin_graph_to_autoscale_request_initial, build_migrate_gremlin_graph_to_manual_throughput_request_initial, build_retrieve_continuous_backup_information_request_initial, build_update_gremlin_database_throughput_request_initial, build_update_gremlin_graph_throughput_request_initial +from ...operations._gremlin_resources_operations import build_create_update_gremlin_database_request_initial, build_create_update_gremlin_graph_request_initial, build_delete_gremlin_database_request_initial, build_delete_gremlin_graph_request_initial, build_get_gremlin_database_request, build_get_gremlin_database_throughput_request, build_get_gremlin_graph_request, build_get_gremlin_graph_throughput_request, build_list_gremlin_databases_request, build_list_gremlin_graphs_request, build_migrate_gremlin_database_to_autoscale_request_initial, build_migrate_gremlin_database_to_manual_throughput_request_initial, build_migrate_gremlin_graph_to_autoscale_request_initial, build_migrate_gremlin_graph_to_manual_throughput_request_initial, build_update_gremlin_database_throughput_request_initial, build_update_gremlin_graph_throughput_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class GremlinResourcesOperations: # pylint: disable=too-many-public-methods - """GremlinResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`gremlin_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_gremlin_databases( @@ -53,7 +52,7 @@ def list_gremlin_databases( resource_group_name: str, account_name: str, **kwargs: Any - ) -> 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. @@ -67,13 +66,16 @@ def list_gremlin_databases( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_gremlin_databases.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get_gremlin_database( account_name: str, database_name: str, **kwargs: Any - ) -> "_models.GremlinDatabaseGetResults": + ) -> _models.GremlinDatabaseGetResults: """Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. @@ -152,13 +158,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.GremlinDatabaseGetResults] request = build_get_gremlin_database_request( @@ -168,11 +177,13 @@ async def get_gremlin_database( database_name=database_name, api_version=api_version, template_url=self.get_gremlin_database.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -198,17 +209,20 @@ 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: Any - ) -> Optional["_models.GremlinDatabaseGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GremlinDatabaseGetResults"]] + ) -> Optional[_models.GremlinDatabaseGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.GremlinDatabaseGetResults]] _json = self._serialize.body(create_update_gremlin_database_parameters, 'GremlinDatabaseCreateUpdateParameters') @@ -221,11 +235,13 @@ async def _create_update_gremlin_database_initial( content_type=content_type, json=_json, template_url=self._create_update_gremlin_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -254,9 +270,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: Any - ) -> 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. @@ -283,17 +299,20 @@ async def begin_create_update_gremlin_database( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.GremlinDatabaseGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_gremlin_database_initial( + raw_result = await self._create_update_gremlin_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -301,20 +320,27 @@ async def begin_create_update_gremlin_database( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GremlinDatabaseGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -334,13 +360,16 @@ async def _delete_gremlin_database_initial( # pylint: disable=inconsistent-retu database_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_gremlin_database_request_initial( @@ -350,11 +379,13 @@ async def _delete_gremlin_database_initial( # pylint: disable=inconsistent-retu database_name=database_name, api_version=api_version, template_url=self._delete_gremlin_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -399,21 +430,26 @@ async def begin_delete_gremlin_database( # pylint: disable=inconsistent-return- :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_gremlin_database_initial( + raw_result = await self._delete_gremlin_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -423,8 +459,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -444,7 +486,7 @@ async def get_gremlin_database_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> "_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. @@ -459,13 +501,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_gremlin_database_throughput_request( @@ -475,11 +520,13 @@ async def get_gremlin_database_throughput( database_name=database_name, api_version=api_version, template_url=self.get_gremlin_database_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -505,17 +552,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -528,11 +578,13 @@ async def _update_gremlin_database_throughput_initial( content_type=content_type, json=_json, template_url=self._update_gremlin_database_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -561,9 +613,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: Any - ) -> 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. @@ -590,17 +642,20 @@ async def begin_update_gremlin_database_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_gremlin_database_throughput_initial( + raw_result = await self._update_gremlin_database_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -608,20 +663,27 @@ async def begin_update_gremlin_database_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -640,14 +702,17 @@ async def _migrate_gremlin_database_to_autoscale_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_gremlin_database_to_autoscale_request_initial( @@ -657,11 +722,13 @@ async def _migrate_gremlin_database_to_autoscale_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_gremlin_database_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -691,7 +758,7 @@ async def begin_migrate_gremlin_database_to_autoscale( account_name: str, database_name: str, **kwargs: Any - ) -> 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. @@ -714,35 +781,45 @@ async def begin_migrate_gremlin_database_to_autoscale( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_gremlin_database_to_autoscale_initial( + raw_result = await self._migrate_gremlin_database_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -761,14 +838,17 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_gremlin_database_to_manual_throughput_request_initial( @@ -778,11 +858,13 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_gremlin_database_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -812,7 +894,7 @@ async def begin_migrate_gremlin_database_to_manual_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> 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. @@ -835,35 +917,45 @@ async def begin_migrate_gremlin_database_to_manual_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_gremlin_database_to_manual_throughput_initial( + raw_result = await self._migrate_gremlin_database_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -883,7 +975,7 @@ def list_gremlin_graphs( account_name: str, database_name: str, **kwargs: Any - ) -> 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. @@ -899,13 +991,16 @@ def list_gremlin_graphs( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -916,9 +1011,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=self.list_gremlin_graphs.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -929,9 +1026,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -972,7 +1071,7 @@ async def get_gremlin_graph( database_name: str, graph_name: str, **kwargs: Any - ) -> "_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. @@ -988,13 +1087,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.GremlinGraphGetResults] request = build_get_gremlin_graph_request( @@ -1005,11 +1107,13 @@ async def get_gremlin_graph( graph_name=graph_name, api_version=api_version, template_url=self.get_gremlin_graph.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1036,17 +1140,20 @@ 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: Any - ) -> Optional["_models.GremlinGraphGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GremlinGraphGetResults"]] + ) -> Optional[_models.GremlinGraphGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.GremlinGraphGetResults]] _json = self._serialize.body(create_update_gremlin_graph_parameters, 'GremlinGraphCreateUpdateParameters') @@ -1060,11 +1167,13 @@ async def _create_update_gremlin_graph_initial( content_type=content_type, json=_json, template_url=self._create_update_gremlin_graph_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1094,9 +1203,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: Any - ) -> 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. @@ -1124,17 +1233,20 @@ async def begin_create_update_gremlin_graph( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.GremlinGraphGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinGraphGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_gremlin_graph_initial( + raw_result = await self._create_update_gremlin_graph_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1143,20 +1255,27 @@ async def begin_create_update_gremlin_graph( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GremlinGraphGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1177,13 +1296,16 @@ async def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return- graph_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_gremlin_graph_request_initial( @@ -1194,11 +1316,13 @@ async def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return- graph_name=graph_name, api_version=api_version, template_url=self._delete_gremlin_graph_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1246,22 +1370,27 @@ async def begin_delete_gremlin_graph( # pylint: disable=inconsistent-return-sta :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_gremlin_graph_initial( + raw_result = await self._delete_gremlin_graph_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, graph_name=graph_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1271,8 +1400,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1293,7 +1428,7 @@ async def get_gremlin_graph_throughput( database_name: str, graph_name: str, **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": + ) -> _models.ThroughputSettingsGetResults: """Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. @@ -1310,13 +1445,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_gremlin_graph_throughput_request( @@ -1327,11 +1465,13 @@ async def get_gremlin_graph_throughput( graph_name=graph_name, api_version=api_version, template_url=self.get_gremlin_graph_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1358,17 +1498,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -1382,11 +1525,13 @@ async def _update_gremlin_graph_throughput_initial( content_type=content_type, json=_json, template_url=self._update_gremlin_graph_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1416,9 +1561,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: Any - ) -> 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. @@ -1447,17 +1592,20 @@ async def begin_update_gremlin_graph_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_gremlin_graph_throughput_initial( + raw_result = await self._update_gremlin_graph_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1466,20 +1614,27 @@ async def begin_update_gremlin_graph_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1499,14 +1654,17 @@ async def _migrate_gremlin_graph_to_autoscale_initial( database_name: str, graph_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_gremlin_graph_to_autoscale_request_initial( @@ -1517,11 +1675,13 @@ async def _migrate_gremlin_graph_to_autoscale_initial( graph_name=graph_name, api_version=api_version, template_url=self._migrate_gremlin_graph_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1552,7 +1712,7 @@ async def begin_migrate_gremlin_graph_to_autoscale( database_name: str, graph_name: str, **kwargs: Any - ) -> 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. @@ -1577,36 +1737,46 @@ async def begin_migrate_gremlin_graph_to_autoscale( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_gremlin_graph_to_autoscale_initial( + raw_result = await self._migrate_gremlin_graph_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, graph_name=graph_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1626,14 +1796,17 @@ async def _migrate_gremlin_graph_to_manual_throughput_initial( database_name: str, graph_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_gremlin_graph_to_manual_throughput_request_initial( @@ -1644,11 +1817,13 @@ async def _migrate_gremlin_graph_to_manual_throughput_initial( graph_name=graph_name, api_version=api_version, template_url=self._migrate_gremlin_graph_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1679,7 +1854,7 @@ async def begin_migrate_gremlin_graph_to_manual_throughput( database_name: str, graph_name: str, **kwargs: Any - ) -> 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. @@ -1704,173 +1879,46 @@ async def begin_migrate_gremlin_graph_to_manual_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_gremlin_graph_to_manual_throughput_initial( + raw_result = await self._migrate_gremlin_graph_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, graph_name=graph_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_gremlin_graph_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - async def _retrieve_continuous_backup_information_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> Optional["_models.BackupInformation"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInformation"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') - - request = build_retrieve_continuous_backup_information_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - graph_name=graph_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupInformation', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _retrieve_continuous_backup_information_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation"} # type: ignore - - - @distributed_trace_async - async def begin_retrieve_continuous_backup_information( - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> AsyncLROPoller["_models.BackupInformation"]: - """Retrieves continuous backup information for a gremlin graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param graph_name: Cosmos DB graph name. - :type graph_name: str - :param location: The name of the continuous backup restore location. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 BackupInformation or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInformation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._retrieve_continuous_backup_information_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - graph_name=graph_name, - location=location, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BackupInformation', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1881,4 +1929,4 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_retrieve_continuous_backup_information.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation"} # type: ignore + begin_migrate_gremlin_graph_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_locations_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_locations_operations.py index 5318ae66f637..b7d9c553636f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_locations_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_locations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class LocationsOperations: - """LocationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`locations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.LocationListResult"]: + ) -> AsyncIterable[_models.LocationListResult]: """List Cosmos DB locations and their properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,13 +56,16 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LocationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -71,9 +73,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -81,9 +85,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -121,7 +127,7 @@ async def get( self, location: str, **kwargs: Any - ) -> "_models.LocationGetResult": + ) -> _models.LocationGetResult: """Get the properties of an existing Cosmos DB location. :param location: Cosmos DB region, with spaces between words and each word capitalized. @@ -131,13 +137,16 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationGetResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LocationGetResult] request = build_get_request( @@ -145,11 +154,13 @@ async def get( location=location, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs 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 6f9a2e8fdc37..56f067bc5fa0 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,35 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._mongo_db_resources_operations import build_create_update_mongo_db_collection_request_initial, build_create_update_mongo_db_database_request_initial, build_create_update_mongo_role_definition_request_initial, build_create_update_mongo_user_definition_request_initial, build_delete_mongo_db_collection_request_initial, build_delete_mongo_db_database_request_initial, build_delete_mongo_role_definition_request_initial, build_delete_mongo_user_definition_request_initial, build_get_mongo_db_collection_request, build_get_mongo_db_collection_throughput_request, build_get_mongo_db_database_request, build_get_mongo_db_database_throughput_request, build_get_mongo_role_definition_request, build_get_mongo_user_definition_request, build_list_mongo_db_collection_partition_merge_request_initial, build_list_mongo_db_collections_request, build_list_mongo_db_databases_request, build_list_mongo_role_definitions_request, build_list_mongo_user_definitions_request, build_migrate_mongo_db_collection_to_autoscale_request_initial, build_migrate_mongo_db_collection_to_manual_throughput_request_initial, build_migrate_mongo_db_database_to_autoscale_request_initial, build_migrate_mongo_db_database_to_manual_throughput_request_initial, build_mongo_db_container_redistribute_throughput_request_initial, build_mongo_db_container_retrieve_throughput_distribution_request_initial, build_retrieve_continuous_backup_information_request_initial, build_update_mongo_db_collection_throughput_request_initial, build_update_mongo_db_database_throughput_request_initial +from ...operations._mongo_db_resources_operations import build_create_update_mongo_db_collection_request_initial, build_create_update_mongo_db_database_request_initial, build_delete_mongo_db_collection_request_initial, build_delete_mongo_db_database_request_initial, build_get_mongo_db_collection_request, build_get_mongo_db_collection_throughput_request, build_get_mongo_db_database_request, build_get_mongo_db_database_throughput_request, build_list_mongo_db_collections_request, build_list_mongo_db_databases_request, build_migrate_mongo_db_collection_to_autoscale_request_initial, build_migrate_mongo_db_collection_to_manual_throughput_request_initial, build_migrate_mongo_db_database_to_autoscale_request_initial, build_migrate_mongo_db_database_to_manual_throughput_request_initial, build_retrieve_continuous_backup_information_request_initial, build_update_mongo_db_collection_throughput_request_initial, build_update_mongo_db_database_throughput_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MongoDBResourcesOperations: # pylint: disable=too-many-public-methods - """MongoDBResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`mongo_db_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_mongo_db_databases( @@ -53,7 +52,7 @@ def list_mongo_db_databases( resource_group_name: str, account_name: str, **kwargs: Any - ) -> 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. @@ -67,13 +66,16 @@ def list_mongo_db_databases( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_mongo_db_databases.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get_mongo_db_database( account_name: str, database_name: str, **kwargs: Any - ) -> "_models.MongoDBDatabaseGetResults": + ) -> _models.MongoDBDatabaseGetResults: """Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. @@ -152,13 +158,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MongoDBDatabaseGetResults] request = build_get_mongo_db_database_request( @@ -168,11 +177,13 @@ async def get_mongo_db_database( database_name=database_name, api_version=api_version, template_url=self.get_mongo_db_database.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -198,17 +209,20 @@ 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: Any - ) -> Optional["_models.MongoDBDatabaseGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoDBDatabaseGetResults"]] + ) -> Optional[_models.MongoDBDatabaseGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MongoDBDatabaseGetResults]] _json = self._serialize.body(create_update_mongo_db_database_parameters, 'MongoDBDatabaseCreateUpdateParameters') @@ -221,11 +235,13 @@ async def _create_update_mongo_db_database_initial( content_type=content_type, json=_json, template_url=self._create_update_mongo_db_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -254,9 +270,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: Any - ) -> 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. @@ -283,17 +299,20 @@ async def begin_create_update_mongo_db_database( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MongoDBDatabaseGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_mongo_db_database_initial( + raw_result = await self._create_update_mongo_db_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -301,20 +320,27 @@ async def begin_create_update_mongo_db_database( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MongoDBDatabaseGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -334,13 +360,16 @@ async def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-ret database_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_mongo_db_database_request_initial( @@ -350,11 +379,13 @@ async def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-ret database_name=database_name, api_version=api_version, template_url=self._delete_mongo_db_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -399,21 +430,26 @@ async def begin_delete_mongo_db_database( # pylint: disable=inconsistent-return :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_mongo_db_database_initial( + raw_result = await self._delete_mongo_db_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -423,8 +459,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -444,7 +486,7 @@ async def get_mongo_db_database_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> "_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. @@ -459,13 +501,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_mongo_db_database_throughput_request( @@ -475,11 +520,13 @@ async def get_mongo_db_database_throughput( database_name=database_name, api_version=api_version, template_url=self.get_mongo_db_database_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -505,17 +552,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -528,11 +578,13 @@ async def _update_mongo_db_database_throughput_initial( content_type=content_type, json=_json, template_url=self._update_mongo_db_database_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -561,9 +613,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: Any - ) -> 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. @@ -590,17 +642,20 @@ async def begin_update_mongo_db_database_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_mongo_db_database_throughput_initial( + raw_result = await self._update_mongo_db_database_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -608,20 +663,27 @@ async def begin_update_mongo_db_database_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -640,14 +702,17 @@ async def _migrate_mongo_db_database_to_autoscale_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_mongo_db_database_to_autoscale_request_initial( @@ -657,11 +722,13 @@ async def _migrate_mongo_db_database_to_autoscale_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_mongo_db_database_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -691,7 +758,7 @@ async def begin_migrate_mongo_db_database_to_autoscale( account_name: str, database_name: str, **kwargs: Any - ) -> 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. @@ -714,35 +781,45 @@ async def begin_migrate_mongo_db_database_to_autoscale( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_mongo_db_database_to_autoscale_initial( + raw_result = await self._migrate_mongo_db_database_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -761,14 +838,17 @@ async def _migrate_mongo_db_database_to_manual_throughput_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_mongo_db_database_to_manual_throughput_request_initial( @@ -778,11 +858,13 @@ async def _migrate_mongo_db_database_to_manual_throughput_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_mongo_db_database_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -812,7 +894,7 @@ async def begin_migrate_mongo_db_database_to_manual_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> 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. @@ -835,314 +917,45 @@ async def begin_migrate_mongo_db_database_to_manual_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._migrate_mongo_db_database_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_mongo_db_database_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - async def _mongo_db_container_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: "_models.RetrieveThroughputParameters", - **kwargs: Any - ) -> Optional["_models.PhysicalPartitionThroughputInfoResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionThroughputInfoResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(retrieve_throughput_parameters, 'RetrieveThroughputParameters') - - request = build_mongo_db_container_retrieve_throughput_distribution_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._mongo_db_container_retrieve_throughput_distribution_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_container_retrieve_throughput_distribution_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @distributed_trace_async - async def begin_mongo_db_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: "_models.RetrieveThroughputParameters", - **kwargs: Any - ) -> AsyncLROPoller["_models.PhysicalPartitionThroughputInfoResult"]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param collection_name: Cosmos DB collection name. - :type collection_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB container. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionThroughputInfoResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._mongo_db_container_retrieve_throughput_distribution_initial( + raw_result = await self._migrate_mongo_db_database_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_mongo_db_container_retrieve_throughput_distribution.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - async def _mongo_db_container_redistribute_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: "_models.RedistributeThroughputParameters", - **kwargs: Any - ) -> Optional["_models.PhysicalPartitionThroughputInfoResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionThroughputInfoResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(redistribute_throughput_parameters, 'RedistributeThroughputParameters') - - request = build_mongo_db_container_redistribute_throughput_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._mongo_db_container_redistribute_throughput_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_container_redistribute_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - - @distributed_trace_async - async def begin_mongo_db_container_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: "_models.RedistributeThroughputParameters", - **kwargs: Any - ) -> AsyncLROPoller["_models.PhysicalPartitionThroughputInfoResult"]: - """Redistribute throughput for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param collection_name: Cosmos DB collection name. - :type collection_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB container. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionThroughputInfoResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._mongo_db_container_redistribute_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1153,7 +966,7 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_mongo_db_container_redistribute_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput"} # type: ignore + begin_migrate_mongo_db_database_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace def list_mongo_db_collections( @@ -1162,7 +975,7 @@ def list_mongo_db_collections( account_name: str, database_name: str, **kwargs: Any - ) -> 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. @@ -1178,13 +991,16 @@ def list_mongo_db_collections( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1195,9 +1011,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=self.list_mongo_db_collections.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1208,9 +1026,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1251,7 +1071,7 @@ async def get_mongo_db_collection( database_name: str, collection_name: str, **kwargs: Any - ) -> "_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. @@ -1267,13 +1087,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MongoDBCollectionGetResults] request = build_get_mongo_db_collection_request( @@ -1284,11 +1107,13 @@ async def get_mongo_db_collection( collection_name=collection_name, api_version=api_version, template_url=self.get_mongo_db_collection.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1315,17 +1140,20 @@ 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: Any - ) -> Optional["_models.MongoDBCollectionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoDBCollectionGetResults"]] + ) -> Optional[_models.MongoDBCollectionGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MongoDBCollectionGetResults]] _json = self._serialize.body(create_update_mongo_db_collection_parameters, 'MongoDBCollectionCreateUpdateParameters') @@ -1339,11 +1167,13 @@ async def _create_update_mongo_db_collection_initial( content_type=content_type, json=_json, template_url=self._create_update_mongo_db_collection_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1373,9 +1203,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: Any - ) -> 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. @@ -1404,17 +1234,20 @@ async def begin_create_update_mongo_db_collection( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MongoDBCollectionGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBCollectionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_mongo_db_collection_initial( + raw_result = await self._create_update_mongo_db_collection_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1423,20 +1256,27 @@ async def begin_create_update_mongo_db_collection( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MongoDBCollectionGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1457,13 +1297,16 @@ async def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-r collection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_mongo_db_collection_request_initial( @@ -1474,11 +1317,13 @@ async def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-r collection_name=collection_name, api_version=api_version, template_url=self._delete_mongo_db_collection_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1526,22 +1371,27 @@ async def begin_delete_mongo_db_collection( # pylint: disable=inconsistent-retu :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_mongo_db_collection_initial( + raw_result = await self._delete_mongo_db_collection_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, collection_name=collection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1551,146 +1401,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_mongo_db_collection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore - - async def _list_mongo_db_collection_partition_merge_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: "_models.MergeParameters", - **kwargs: Any - ) -> Optional["_models.PhysicalPartitionStorageInfoCollection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionStorageInfoCollection"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(merge_parameters, 'MergeParameters') - - request = build_list_mongo_db_collection_partition_merge_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._list_mongo_db_collection_partition_merge_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _list_mongo_db_collection_partition_merge_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge"} # type: ignore - - - @distributed_trace_async - async def begin_list_mongo_db_collection_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: "_models.MergeParameters", - **kwargs: Any - ) -> AsyncLROPoller["_models.PhysicalPartitionStorageInfoCollection"]: - """Merges the partitions of a MongoDB Collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param collection_name: Cosmos DB collection name. - :type collection_name: str - :param merge_parameters: The parameters for the merge operation. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 - PhysicalPartitionStorageInfoCollection or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionStorageInfoCollection"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._list_mongo_db_collection_partition_merge_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - merge_parameters=merge_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1701,7 +1419,7 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_list_mongo_db_collection_partition_merge.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge"} # type: ignore + begin_delete_mongo_db_collection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore @distributed_trace_async async def get_mongo_db_collection_throughput( @@ -1711,7 +1429,7 @@ async def get_mongo_db_collection_throughput( database_name: str, collection_name: str, **kwargs: Any - ) -> "_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. @@ -1728,13 +1446,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_mongo_db_collection_throughput_request( @@ -1745,11 +1466,13 @@ async def get_mongo_db_collection_throughput( collection_name=collection_name, api_version=api_version, template_url=self.get_mongo_db_collection_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1776,17 +1499,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -1800,11 +1526,13 @@ async def _update_mongo_db_collection_throughput_initial( content_type=content_type, json=_json, template_url=self._update_mongo_db_collection_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1834,9 +1562,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: Any - ) -> 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. @@ -1865,17 +1593,20 @@ async def begin_update_mongo_db_collection_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_mongo_db_collection_throughput_initial( + raw_result = await self._update_mongo_db_collection_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1884,20 +1615,27 @@ async def begin_update_mongo_db_collection_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1917,14 +1655,17 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( database_name: str, collection_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_mongo_db_collection_to_autoscale_request_initial( @@ -1935,11 +1676,13 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( collection_name=collection_name, api_version=api_version, template_url=self._migrate_mongo_db_collection_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1970,7 +1713,7 @@ async def begin_migrate_mongo_db_collection_to_autoscale( database_name: str, collection_name: str, **kwargs: Any - ) -> 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. @@ -1995,36 +1738,46 @@ async def begin_migrate_mongo_db_collection_to_autoscale( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_mongo_db_collection_to_autoscale_initial( + raw_result = await self._migrate_mongo_db_collection_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, collection_name=collection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -2044,14 +1797,17 @@ async def _migrate_mongo_db_collection_to_manual_throughput_initial( database_name: str, collection_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_mongo_db_collection_to_manual_throughput_request_initial( @@ -2062,11 +1818,13 @@ async def _migrate_mongo_db_collection_to_manual_throughput_initial( collection_name=collection_name, api_version=api_version, template_url=self._migrate_mongo_db_collection_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2097,7 +1855,7 @@ async def begin_migrate_mongo_db_collection_to_manual_throughput( database_name: str, collection_name: str, **kwargs: Any - ) -> 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. @@ -2122,36 +1880,46 @@ async def begin_migrate_mongo_db_collection_to_manual_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_mongo_db_collection_to_manual_throughput_initial( + raw_result = await self._migrate_mongo_db_collection_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, collection_name=collection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -2164,102 +1932,46 @@ def get_long_running_output(pipeline_response): begin_migrate_mongo_db_collection_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - @distributed_trace_async - async def get_mongo_role_definition( + async def _retrieve_continuous_backup_information_initial( self, - mongo_role_definition_id: str, resource_group_name: str, account_name: str, + database_name: str, + collection_name: str, + location: _models.ContinuousBackupRestoreLocation, **kwargs: Any - ) -> "_models.MongoRoleDefinitionGetResults": - """Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given - Id. - - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. - :type mongo_role_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MongoRoleDefinitionGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoRoleDefinitionGetResults"] + ) -> Optional[_models.BackupInformation]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_mongo_role_definition_request( - mongo_role_definition_id=mongo_role_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.get_mongo_role_definition.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MongoRoleDefinitionGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_mongo_role_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore - + error_map.update(kwargs.pop('error_map', {}) or {}) - async def _create_update_mongo_role_definition_initial( - self, - mongo_role_definition_id: str, - resource_group_name: str, - account_name: str, - create_update_mongo_role_definition_parameters: "_models.MongoRoleDefinitionCreateUpdateParameters", - **kwargs: Any - ) -> Optional["_models.MongoRoleDefinitionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoRoleDefinitionGetResults"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.BackupInformation]] - _json = self._serialize.body(create_update_mongo_role_definition_parameters, 'MongoRoleDefinitionCreateUpdateParameters') + _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') - request = build_create_update_mongo_role_definition_request_initial( - mongo_role_definition_id=mongo_role_definition_id, + request = build_retrieve_continuous_backup_information_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, + collection_name=collection_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_update_mongo_role_definition_initial.metadata['url'], + template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2272,37 +1984,38 @@ async def _create_update_mongo_role_definition_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MongoRoleDefinitionGetResults', pipeline_response) + deserialized = self._deserialize('BackupInformation', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_update_mongo_role_definition_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation"} # type: ignore @distributed_trace_async - async def begin_create_update_mongo_role_definition( + async def begin_retrieve_continuous_backup_information( self, - mongo_role_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: "_models.MongoRoleDefinitionCreateUpdateParameters", + database_name: str, + collection_name: str, + location: _models.ContinuousBackupRestoreLocation, **kwargs: Any - ) -> AsyncLROPoller["_models.MongoRoleDefinitionGetResults"]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. - :type mongo_role_definition_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param account_name: Cosmos DB database account name. :type account_name: str - :param create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. - :type create_update_mongo_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param location: The name of the continuous backup restore location. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation :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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -2311,764 +2024,54 @@ async def begin_create_update_mongo_role_definition( :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 MongoRoleDefinitionGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + :return: An instance of AsyncLROPoller that returns either BackupInformation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupInformation] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoRoleDefinitionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_mongo_role_definition_initial( - mongo_role_definition_id=mongo_role_definition_id, + raw_result = await self._retrieve_continuous_backup_information_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, - create_update_mongo_role_definition_parameters=create_update_mongo_role_definition_parameters, + database_name=database_name, + collection_name=collection_name, + location=location, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MongoRoleDefinitionGetResults', pipeline_response) + deserialized = self._deserialize('BackupInformation', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_mongo_role_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore - - async def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent-return-statements - self, - mongo_role_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_delete_mongo_role_definition_request_initial( - mongo_role_definition_id=mongo_role_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self._delete_mongo_role_definition_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_mongo_role_definition_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore - - - @distributed_trace_async - async def begin_delete_mongo_role_definition( # pylint: disable=inconsistent-return-statements - self, - mongo_role_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Mongo Role Definition. - - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. - :type mongo_role_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_mongo_role_definition_initial( - mongo_role_definition_id=mongo_role_definition_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_mongo_role_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore - - @distributed_trace - def list_mongo_role_definitions( - self, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.MongoRoleDefinitionListResult"]: - """Retrieves the list of all Azure Cosmos DB Mongo Role Definitions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MongoRoleDefinitionListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoRoleDefinitionListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_mongo_role_definitions_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.list_mongo_role_definitions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_mongo_role_definitions_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MongoRoleDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_mongo_role_definitions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions"} # type: ignore - - @distributed_trace_async - async def get_mongo_user_definition( - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> "_models.MongoUserDefinitionGetResults": - """Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given - Id. - - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. - :type mongo_user_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MongoUserDefinitionGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoUserDefinitionGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_mongo_user_definition_request( - mongo_user_definition_id=mongo_user_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.get_mongo_user_definition.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MongoUserDefinitionGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_mongo_user_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - - async def _create_update_mongo_user_definition_initial( - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - create_update_mongo_user_definition_parameters: "_models.MongoUserDefinitionCreateUpdateParameters", - **kwargs: Any - ) -> Optional["_models.MongoUserDefinitionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoUserDefinitionGetResults"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(create_update_mongo_user_definition_parameters, 'MongoUserDefinitionCreateUpdateParameters') - - request = build_create_update_mongo_user_definition_request_initial( - mongo_user_definition_id=mongo_user_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_update_mongo_user_definition_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MongoUserDefinitionGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_mongo_user_definition_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - - @distributed_trace_async - async def begin_create_update_mongo_user_definition( - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - create_update_mongo_user_definition_parameters: "_models.MongoUserDefinitionCreateUpdateParameters", - **kwargs: Any - ) -> AsyncLROPoller["_models.MongoUserDefinitionGetResults"]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. - - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. - :type mongo_user_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. - :type create_update_mongo_user_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 MongoUserDefinitionGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoUserDefinitionGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_update_mongo_user_definition_initial( - mongo_user_definition_id=mongo_user_definition_id, - resource_group_name=resource_group_name, - account_name=account_name, - create_update_mongo_user_definition_parameters=create_update_mongo_user_definition_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MongoUserDefinitionGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_mongo_user_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - async def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent-return-statements - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_delete_mongo_user_definition_request_initial( - mongo_user_definition_id=mongo_user_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self._delete_mongo_user_definition_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_mongo_user_definition_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - - @distributed_trace_async - async def begin_delete_mongo_user_definition( # pylint: disable=inconsistent-return-statements - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Mongo User Definition. - - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. - :type mongo_user_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_mongo_user_definition_initial( - mongo_user_definition_id=mongo_user_definition_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_mongo_user_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - @distributed_trace - def list_mongo_user_definitions( - self, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.MongoUserDefinitionListResult"]: - """Retrieves the list of all Azure Cosmos DB Mongo User Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MongoUserDefinitionListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoUserDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoUserDefinitionListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_mongo_user_definitions_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.list_mongo_user_definitions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, - request = build_list_mongo_user_definitions_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MongoUserDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_mongo_user_definitions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions"} # type: ignore - - async def _retrieve_continuous_backup_information_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> Optional["_models.BackupInformation"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInformation"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') - - request = build_retrieve_continuous_backup_information_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupInformation', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _retrieve_continuous_backup_information_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation"} # type: ignore - - - @distributed_trace_async - async def begin_retrieve_continuous_backup_information( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> AsyncLROPoller["_models.BackupInformation"]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param collection_name: Cosmos DB collection name. - :type collection_name: str - :param location: The name of the continuous backup restore location. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 BackupInformation or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInformation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._retrieve_continuous_backup_information_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - location=location, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BackupInformation', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_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 11238ab22182..0e4d65aadbb7 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class NotebookWorkspacesOperations: - """NotebookWorkspacesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`notebook_workspaces` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_database_account( @@ -53,7 +52,7 @@ def list_by_database_account( resource_group_name: str, account_name: str, **kwargs: Any - ) -> 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. @@ -67,13 +66,16 @@ def list_by_database_account( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.NotebookWorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_by_database_account.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( account_name: str, notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any - ) -> "_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. @@ -152,13 +158,16 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotebookWorkspace] request = build_get_request( @@ -168,11 +177,13 @@ async def get( notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -199,17 +210,20 @@ async def _create_or_update_initial( resource_group_name: str, account_name: str, notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], - notebook_create_update_parameters: "_models.NotebookWorkspaceCreateUpdateParameters", + notebook_create_update_parameters: _models.NotebookWorkspaceCreateUpdateParameters, **kwargs: Any - ) -> "_models.NotebookWorkspace": - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] + ) -> _models.NotebookWorkspace: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotebookWorkspace] _json = self._serialize.body(notebook_create_update_parameters, 'NotebookWorkspaceCreateUpdateParameters') @@ -222,11 +236,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -253,9 +269,9 @@ async def begin_create_or_update( resource_group_name: str, account_name: str, notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], - notebook_create_update_parameters: "_models.NotebookWorkspaceCreateUpdateParameters", + notebook_create_update_parameters: _models.NotebookWorkspaceCreateUpdateParameters, **kwargs: Any - ) -> 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. @@ -281,17 +297,20 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotebookWorkspace] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, @@ -299,20 +318,27 @@ async def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('NotebookWorkspace', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -332,13 +358,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -348,11 +377,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,21 +428,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -421,8 +457,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -442,7 +484,7 @@ async def list_connection_info( account_name: str, notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any - ) -> "_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. @@ -456,13 +498,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotebookWorkspaceConnectionInfoResult] request = build_list_connection_info_request( @@ -472,11 +517,13 @@ async def list_connection_info( notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self.list_connection_info.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -505,13 +552,16 @@ async def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_regenerate_auth_token_request_initial( @@ -521,11 +571,13 @@ async def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self._regenerate_auth_token_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -570,21 +622,26 @@ async def begin_regenerate_auth_token( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._regenerate_auth_token_initial( + raw_result = await self._regenerate_auth_token_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -594,8 +651,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -615,13 +678,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -631,11 +697,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -680,21 +748,26 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -704,8 +777,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_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 23bdb87e132d..a8030c321e8d 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> 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 @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 d5c7eb96fe7c..4b5b02c0b4ce 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PartitionKeyRangeIdOperations: - """PartitionKeyRangeIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`partition_key_range_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -54,7 +53,7 @@ def list_metrics( partition_key_range_id: str, filter: str, **kwargs: Any - ) -> 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. @@ -78,13 +77,16 @@ def list_metrics( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -98,9 +100,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -114,9 +118,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 b1079a66d8d9..18ab074de406 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PartitionKeyRangeIdRegionOperations: - """PartitionKeyRangeIdRegionOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`partition_key_range_id_region` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -55,7 +54,7 @@ def list_metrics( partition_key_range_id: str, filter: str, **kwargs: Any - ) -> AsyncIterable["_models.PartitionMetricListResult"]: + ) -> AsyncIterable[_models.PartitionMetricListResult]: """Retrieves the metrics determined by the given filter for the given partition key range id and region. @@ -82,13 +81,16 @@ def list_metrics( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -103,9 +105,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -120,9 +124,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 2ef279a66c9d..01aa6559d0d5 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PercentileOperations: - """PercentileOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`percentile` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -51,7 +50,7 @@ def list_metrics( account_name: str, filter: str, **kwargs: Any - ) -> 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. @@ -70,13 +69,16 @@ def list_metrics( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -87,9 +89,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -100,9 +104,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 a01727d45036..c2aa81b29a3d 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PercentileSourceTargetOperations: - """PercentileSourceTargetOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`percentile_source_target` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -53,7 +52,7 @@ def list_metrics( target_region: str, filter: str, **kwargs: Any - ) -> 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. @@ -78,13 +77,16 @@ def list_metrics( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -97,9 +99,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -112,9 +116,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 d00fca003cd8..33b82bdc8a14 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,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PercentileTargetOperations: - """PercentileTargetOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`percentile_target` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -52,7 +51,7 @@ def list_metrics( target_region: str, filter: str, **kwargs: Any - ) -> 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. @@ -74,13 +73,16 @@ def list_metrics( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -92,9 +94,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -106,9 +110,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 b42a347a2170..d7417d28d609 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_database_account( @@ -53,7 +52,7 @@ def list_by_database_account( resource_group_name: str, account_name: str, **kwargs: Any - ) -> 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. @@ -67,13 +66,16 @@ def list_by_database_account( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_by_database_account.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( account_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -151,13 +157,16 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -167,11 +176,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -197,17 +208,20 @@ async def _create_or_update_initial( resource_group_name: str, account_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -220,11 +234,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -253,9 +269,9 @@ async def begin_create_or_update( resource_group_name: str, account_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + ) -> 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. @@ -280,17 +296,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -298,20 +317,27 @@ async def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_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) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -331,13 +357,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -347,11 +376,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,21 +427,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -420,8 +456,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_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 1d19c4fd44a0..479e261c4c3b 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 @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_database_account( @@ -51,7 +50,7 @@ def list_by_database_account( resource_group_name: str, account_name: str, **kwargs: Any - ) -> 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. @@ -65,13 +64,16 @@ def list_by_database_account( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -81,9 +83,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_by_database_account.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -93,9 +97,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -135,7 +141,7 @@ async def get( account_name: str, group_name: str, **kwargs: Any - ) -> "_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. @@ -149,13 +155,16 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] request = build_get_request( @@ -165,11 +174,13 @@ async def get( group_name=group_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_database_accounts_operations.py index ac77a557835e..59a343f4c57f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_database_accounts_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,33 +25,31 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class RestorableDatabaseAccountsOperations: - """RestorableDatabaseAccountsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_database_accounts` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_location( self, location: str, **kwargs: Any - ) -> AsyncIterable["_models.RestorableDatabaseAccountsListResult"]: + ) -> AsyncIterable[_models.RestorableDatabaseAccountsListResult]: """Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. @@ -64,13 +63,16 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableDatabaseAccountsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDatabaseAccountsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -79,9 +81,11 @@ def prepare_request(next_link=None): location=location, api_version=api_version, template_url=self.list_by_location.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -90,9 +94,11 @@ def prepare_request(next_link=None): location=location, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -129,7 +135,7 @@ async def get_next(next_link=None): def list( self, **kwargs: Any - ) -> AsyncIterable["_models.RestorableDatabaseAccountsListResult"]: + ) -> AsyncIterable[_models.RestorableDatabaseAccountsListResult]: """Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. @@ -140,13 +146,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableDatabaseAccountsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDatabaseAccountsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -154,9 +163,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -164,9 +175,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -205,7 +218,7 @@ async def get_by_location( location: str, instance_id: str, **kwargs: Any - ) -> "_models.RestorableDatabaseAccountGetResult": + ) -> _models.RestorableDatabaseAccountGetResult: """Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. @@ -218,13 +231,16 @@ async def get_by_location( :rtype: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDatabaseAccountGetResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableDatabaseAccountGetResult] request = build_get_by_location_request( @@ -233,11 +249,13 @@ async def get_by_location( instance_id=instance_id, api_version=api_version, template_url=self.get_by_location.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_databases_operations.py deleted file mode 100644 index c7702c4ad096..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_databases_operations.py +++ /dev/null @@ -1,131 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._restorable_gremlin_databases_operations import build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RestorableGremlinDatabasesOperations: - """RestorableGremlinDatabasesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - **kwargs: Any - ) -> AsyncIterable["_models.RestorableGremlinDatabasesListResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin databases under - the restorable account. This helps in scenario where database was accidentally deleted to get - the deletion time. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableGremlinDatabasesListResult or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableGremlinDatabasesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableGremlinDatabasesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinDatabases"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_graphs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_graphs_operations.py deleted file mode 100644 index 9cda2dba0685..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_graphs_operations.py +++ /dev/null @@ -1,146 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._restorable_gremlin_graphs_operations import build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RestorableGremlinGraphsOperations: - """RestorableGremlinGraphsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - restorable_gremlin_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RestorableGremlinGraphsListResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs under a - specific database. This helps in scenario where container was accidentally deleted. This API - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :param restorable_gremlin_database_rid: The resource ID of the Gremlin database. Default value - is None. - :type restorable_gremlin_database_rid: str - :param start_time: Restorable Gremlin graphs event feed start time. Default value is None. - :type start_time: str - :param end_time: Restorable Gremlin graphs event feed end time. Default value is None. - :type end_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableGremlinGraphsListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinGraphsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableGremlinGraphsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restorable_gremlin_database_rid=restorable_gremlin_database_rid, - start_time=start_time, - end_time=end_time, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restorable_gremlin_database_rid=restorable_gremlin_database_rid, - start_time=start_time, - end_time=end_time, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableGremlinGraphsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_resources_operations.py deleted file mode 100644 index 76ba9c3fcd61..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_resources_operations.py +++ /dev/null @@ -1,143 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._restorable_gremlin_resources_operations import build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RestorableGremlinResourcesOperations: - """RestorableGremlinResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RestorableGremlinResourcesListResult"]: - """Return a list of gremlin database and graphs combo that exist on the account at the given - timestamp and location. This helps in scenarios to validate what resources exist at given - timestamp and location. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :param restore_location: The location where the restorable resources are located. Default value - is None. - :type restore_location: str - :param restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :type restore_timestamp_in_utc: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableGremlinResourcesListResult or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinResourcesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableGremlinResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableGremlinResourcesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinResources"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_collections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_collections_operations.py index 02cd880d423c..b4e5dd69aa5c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_collections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_collections_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class RestorableMongodbCollectionsOperations: - """RestorableMongodbCollectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_collections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -50,10 +49,8 @@ def list( location: str, instance_id: str, restorable_mongodb_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RestorableMongodbCollectionsListResult"]: + ) -> AsyncIterable[_models.RestorableMongodbCollectionsListResult]: """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. @@ -65,10 +62,6 @@ def list( :param restorable_mongodb_database_rid: The resource ID of the MongoDB database. Default value is None. :type restorable_mongodb_database_rid: str - :param start_time: Restorable MongoDB collections event feed start time. Default value is None. - :type start_time: str - :param end_time: Restorable MongoDB collections event feed end time. Default value is None. - :type end_time: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RestorableMongodbCollectionsListResult or the result of cls(response) @@ -76,13 +69,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableMongodbCollectionsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableMongodbCollectionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -92,12 +88,12 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, restorable_mongodb_database_rid=restorable_mongodb_database_rid, - start_time=start_time, - end_time=end_time, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -107,12 +103,12 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, restorable_mongodb_database_rid=restorable_mongodb_database_rid, - start_time=start_time, - end_time=end_time, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_databases_operations.py index 39595f17c96b..2c58250aeaf2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_databases_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class RestorableMongodbDatabasesOperations: - """RestorableMongodbDatabasesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_databases` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -50,7 +49,7 @@ def list( location: str, instance_id: str, **kwargs: Any - ) -> AsyncIterable["_models.RestorableMongodbDatabasesListResult"]: + ) -> AsyncIterable[_models.RestorableMongodbDatabasesListResult]: """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires @@ -67,13 +66,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbDatabasesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableMongodbDatabasesListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableMongodbDatabasesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_resources_operations.py index 89d4c00793f6..c50160b32aea 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_resources_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class RestorableMongodbResourcesOperations: - """RestorableMongodbResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +51,7 @@ def list( restore_location: Optional[str] = None, restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RestorableMongodbResourcesListResult"]: + ) -> AsyncIterable[_models.RestorableMongodbResourcesListResult]: """Return a list of database and collection combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires @@ -75,13 +74,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbResourcesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableMongodbResourcesListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableMongodbResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -93,9 +95,11 @@ def prepare_request(next_link=None): restore_location=restore_location, restore_timestamp_in_utc=restore_timestamp_in_utc, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -107,9 +111,11 @@ def prepare_request(next_link=None): restore_location=restore_location, restore_timestamp_in_utc=restore_timestamp_in_utc, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_containers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_containers_operations.py index 6307a7132ee0..23df4e825e1b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_containers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_containers_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class RestorableSqlContainersOperations: - """RestorableSqlContainersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_sql_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -53,7 +52,7 @@ def list( start_time: Optional[str] = None, end_time: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RestorableSqlContainersListResult"]: + ) -> AsyncIterable[_models.RestorableSqlContainersListResult]: """Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. @@ -64,9 +63,11 @@ def list( :type instance_id: str :param restorable_sql_database_rid: The resource ID of the SQL database. Default value is None. :type restorable_sql_database_rid: str - :param start_time: Restorable Sql containers event feed start time. Default value is None. + :param start_time: The snapshot create timestamp after which snapshots need to be listed. + Default value is None. :type start_time: str - :param end_time: Restorable Sql containers event feed end time. Default value is None. + :param end_time: The snapshot create timestamp before which snapshots need to be listed. + Default value is None. :type end_time: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RestorableSqlContainersListResult or the result of @@ -75,13 +76,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlContainersListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableSqlContainersListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableSqlContainersListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -94,9 +98,11 @@ def prepare_request(next_link=None): start_time=start_time, end_time=end_time, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -109,9 +115,11 @@ def prepare_request(next_link=None): start_time=start_time, end_time=end_time, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_databases_operations.py index db97f8f67ab7..b9aa5837629f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_databases_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class RestorableSqlDatabasesOperations: - """RestorableSqlDatabasesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_sql_databases` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -50,7 +49,7 @@ def list( location: str, instance_id: str, **kwargs: Any - ) -> AsyncIterable["_models.RestorableSqlDatabasesListResult"]: + ) -> AsyncIterable[_models.RestorableSqlDatabasesListResult]: """Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires @@ -67,13 +66,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlDatabasesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableSqlDatabasesListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableSqlDatabasesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_resources_operations.py index 1d417d1adead..2fd26a14d6f9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_resources_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class RestorableSqlResourcesOperations: - """RestorableSqlResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_sql_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +51,7 @@ def list( restore_location: Optional[str] = None, restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RestorableSqlResourcesListResult"]: + ) -> AsyncIterable[_models.RestorableSqlResourcesListResult]: """Return a list of database and container combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires @@ -75,13 +74,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlResourcesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableSqlResourcesListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableSqlResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -93,9 +95,11 @@ def prepare_request(next_link=None): restore_location=restore_location, restore_timestamp_in_utc=restore_timestamp_in_utc, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -107,9 +111,11 @@ def prepare_request(next_link=None): restore_location=restore_location, restore_timestamp_in_utc=restore_timestamp_in_utc, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_table_resources_operations.py deleted file mode 100644 index 3596c1ed9e9a..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_table_resources_operations.py +++ /dev/null @@ -1,142 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._restorable_table_resources_operations import build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RestorableTableResourcesOperations: - """RestorableTableResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RestorableTableResourcesListResult"]: - """Return a list of tables that exist on the account at the given timestamp and location. This - helps in scenarios to validate what resources exist at given timestamp and location. This API - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :param restore_location: The location where the restorable resources are located. Default value - is None. - :type restore_location: str - :param restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :type restore_timestamp_in_utc: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableTableResourcesListResult or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableResourcesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableTableResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableTableResourcesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTableResources"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_tables_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_tables_operations.py deleted file mode 100644 index 265ed59c8787..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_tables_operations.py +++ /dev/null @@ -1,140 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._restorable_tables_operations import build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RestorableTablesOperations: - """RestorableTablesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RestorableTablesListResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in - scenario where table was accidentally deleted. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :param start_time: Restorable Tables event feed start time. Default value is None. - :type start_time: str - :param end_time: Restorable Tables event feed end time. Default value is None. - :type end_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableTablesListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableTablesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableTablesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - start_time=start_time, - end_time=end_time, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - start_time=start_time, - end_time=end_time, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableTablesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTables"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_service_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_service_operations.py index 330b03be1c96..83bf471cd928 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_service_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_service_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ServiceOperations: - """ServiceOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`service` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -53,7 +52,7 @@ def list( resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceResourceListResult"]: + ) -> AsyncIterable[_models.ServiceResourceListResult]: """Gets the status of service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -67,13 +66,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ServiceResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -135,17 +141,20 @@ async def _create_initial( resource_group_name: str, account_name: str, service_name: str, - create_update_parameters: "_models.ServiceResourceCreateUpdateParameters", + create_update_parameters: _models.ServiceResourceCreateUpdateParameters, **kwargs: Any - ) -> Optional["_models.ServiceResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServiceResource"]] + ) -> Optional[_models.ServiceResource]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ServiceResource]] _json = self._serialize.body(create_update_parameters, 'ServiceResourceCreateUpdateParameters') @@ -158,11 +167,13 @@ async def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -191,9 +202,9 @@ async def begin_create( resource_group_name: str, account_name: str, service_name: str, - create_update_parameters: "_models.ServiceResourceCreateUpdateParameters", + create_update_parameters: _models.ServiceResourceCreateUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceResource"]: + ) -> AsyncLROPoller[_models.ServiceResource]: """Creates a service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -218,17 +229,20 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, service_name=service_name, @@ -236,20 +250,27 @@ async def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -269,7 +290,7 @@ async def get( account_name: str, service_name: str, **kwargs: Any - ) -> "_models.ServiceResource": + ) -> _models.ServiceResource: """Gets the status of service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -283,13 +304,16 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.ServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] request = build_get_request( @@ -299,11 +323,13 @@ async def get( service_name=service_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -331,13 +357,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -347,11 +376,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,21 +427,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, service_name=service_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -420,8 +456,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( 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 6c84c8a0c6f7..35a0259f9b28 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,35 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._sql_resources_operations import build_create_update_client_encryption_key_request_initial, build_create_update_sql_container_request_initial, build_create_update_sql_database_request_initial, build_create_update_sql_role_assignment_request_initial, build_create_update_sql_role_definition_request_initial, build_create_update_sql_stored_procedure_request_initial, build_create_update_sql_trigger_request_initial, build_create_update_sql_user_defined_function_request_initial, build_delete_sql_container_request_initial, build_delete_sql_database_request_initial, build_delete_sql_role_assignment_request_initial, build_delete_sql_role_definition_request_initial, build_delete_sql_stored_procedure_request_initial, build_delete_sql_trigger_request_initial, build_delete_sql_user_defined_function_request_initial, build_get_client_encryption_key_request, build_get_sql_container_request, build_get_sql_container_throughput_request, build_get_sql_database_request, build_get_sql_database_throughput_request, build_get_sql_role_assignment_request, build_get_sql_role_definition_request, build_get_sql_stored_procedure_request, build_get_sql_trigger_request, build_get_sql_user_defined_function_request, build_list_client_encryption_keys_request, build_list_sql_container_partition_merge_request_initial, build_list_sql_containers_request, build_list_sql_databases_request, build_list_sql_role_assignments_request, build_list_sql_role_definitions_request, build_list_sql_stored_procedures_request, build_list_sql_triggers_request, build_list_sql_user_defined_functions_request, build_migrate_sql_container_to_autoscale_request_initial, build_migrate_sql_container_to_manual_throughput_request_initial, build_migrate_sql_database_to_autoscale_request_initial, build_migrate_sql_database_to_manual_throughput_request_initial, build_retrieve_continuous_backup_information_request_initial, build_sql_container_redistribute_throughput_request_initial, build_sql_container_retrieve_throughput_distribution_request_initial, build_update_sql_container_throughput_request_initial, build_update_sql_database_throughput_request_initial +from ...operations._sql_resources_operations import build_create_update_sql_container_request_initial, build_create_update_sql_database_request_initial, build_create_update_sql_role_assignment_request_initial, build_create_update_sql_role_definition_request_initial, build_create_update_sql_stored_procedure_request_initial, build_create_update_sql_trigger_request_initial, build_create_update_sql_user_defined_function_request_initial, build_delete_sql_container_request_initial, build_delete_sql_database_request_initial, build_delete_sql_role_assignment_request_initial, build_delete_sql_role_definition_request_initial, build_delete_sql_stored_procedure_request_initial, build_delete_sql_trigger_request_initial, build_delete_sql_user_defined_function_request_initial, build_get_sql_container_request, build_get_sql_container_throughput_request, build_get_sql_database_request, build_get_sql_database_throughput_request, build_get_sql_role_assignment_request, build_get_sql_role_definition_request, build_get_sql_stored_procedure_request, build_get_sql_trigger_request, build_get_sql_user_defined_function_request, build_list_sql_containers_request, build_list_sql_databases_request, build_list_sql_role_assignments_request, build_list_sql_role_definitions_request, build_list_sql_stored_procedures_request, build_list_sql_triggers_request, build_list_sql_user_defined_functions_request, build_migrate_sql_container_to_autoscale_request_initial, build_migrate_sql_container_to_manual_throughput_request_initial, build_migrate_sql_database_to_autoscale_request_initial, build_migrate_sql_database_to_manual_throughput_request_initial, build_retrieve_continuous_backup_information_request_initial, build_update_sql_container_throughput_request_initial, build_update_sql_database_throughput_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SqlResourcesOperations: # pylint: disable=too-many-public-methods - """SqlResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`sql_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_sql_databases( @@ -53,7 +52,7 @@ def list_sql_databases( resource_group_name: str, account_name: str, **kwargs: Any - ) -> 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. @@ -67,13 +66,16 @@ def list_sql_databases( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_sql_databases.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get_sql_database( account_name: str, database_name: str, **kwargs: Any - ) -> "_models.SqlDatabaseGetResults": + ) -> _models.SqlDatabaseGetResults: """Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. @@ -152,13 +158,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlDatabaseGetResults] request = build_get_sql_database_request( @@ -168,11 +177,13 @@ async def get_sql_database( database_name=database_name, api_version=api_version, template_url=self.get_sql_database.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -198,17 +209,20 @@ 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: Any - ) -> Optional["_models.SqlDatabaseGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlDatabaseGetResults"]] + ) -> Optional[_models.SqlDatabaseGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlDatabaseGetResults]] _json = self._serialize.body(create_update_sql_database_parameters, 'SqlDatabaseCreateUpdateParameters') @@ -221,11 +235,13 @@ async def _create_update_sql_database_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -254,9 +270,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: Any - ) -> 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. @@ -282,17 +298,20 @@ async def begin_create_update_sql_database( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlDatabaseGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_sql_database_initial( + raw_result = await self._create_update_sql_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -300,20 +319,27 @@ async def begin_create_update_sql_database( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlDatabaseGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -333,13 +359,16 @@ async def _delete_sql_database_initial( # pylint: disable=inconsistent-return-s database_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_database_request_initial( @@ -349,11 +378,13 @@ async def _delete_sql_database_initial( # pylint: disable=inconsistent-return-s database_name=database_name, api_version=api_version, template_url=self._delete_sql_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -398,21 +429,26 @@ async def begin_delete_sql_database( # pylint: disable=inconsistent-return-stat :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_sql_database_initial( + raw_result = await self._delete_sql_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -422,8 +458,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -443,7 +485,7 @@ async def get_sql_database_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> "_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. @@ -458,13 +500,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_sql_database_throughput_request( @@ -474,11 +519,13 @@ async def get_sql_database_throughput( database_name=database_name, api_version=api_version, template_url=self.get_sql_database_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -504,17 +551,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -527,11 +577,13 @@ async def _update_sql_database_throughput_initial( content_type=content_type, json=_json, template_url=self._update_sql_database_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -560,9 +612,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: Any - ) -> 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. @@ -589,17 +641,20 @@ async def begin_update_sql_database_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_sql_database_throughput_initial( + raw_result = await self._update_sql_database_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -607,20 +662,27 @@ async def begin_update_sql_database_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -639,14 +701,17 @@ async def _migrate_sql_database_to_autoscale_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_sql_database_to_autoscale_request_initial( @@ -656,11 +721,13 @@ async def _migrate_sql_database_to_autoscale_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_sql_database_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -690,7 +757,7 @@ async def begin_migrate_sql_database_to_autoscale( account_name: str, database_name: str, **kwargs: Any - ) -> 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. @@ -713,35 +780,45 @@ async def begin_migrate_sql_database_to_autoscale( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_sql_database_to_autoscale_initial( + raw_result = await self._migrate_sql_database_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -760,14 +837,17 @@ async def _migrate_sql_database_to_manual_throughput_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_sql_database_to_manual_throughput_request_initial( @@ -777,11 +857,13 @@ async def _migrate_sql_database_to_manual_throughput_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_sql_database_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -811,7 +893,7 @@ async def begin_migrate_sql_database_to_manual_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> 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. @@ -834,35 +916,45 @@ async def begin_migrate_sql_database_to_manual_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_sql_database_to_manual_throughput_initial( + raw_result = await self._migrate_sql_database_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -876,14 +968,14 @@ def get_long_running_output(pipeline_response): begin_migrate_sql_database_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace - def list_client_encryption_keys( + def list_sql_containers( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ClientEncryptionKeysListResult"]: - """Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. + ) -> 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. :type resource_group_name: str @@ -892,50 +984,57 @@ def list_client_encryption_keys( :param database_name: Cosmos DB database name. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClientEncryptionKeysListResult or the result of + :return: An iterator like instance of either SqlContainerListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeysListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlContainerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientEncryptionKeysListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - request = build_list_client_encryption_keys_request( + request = build_list_sql_containers_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, - template_url=self.list_client_encryption_keys.metadata['url'], + template_url=self.list_sql_containers.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - request = build_list_client_encryption_keys_request( + request = build_list_sql_containers_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ClientEncryptionKeysListResult", pipeline_response) + deserialized = self._deserialize("SqlContainerListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -961,18 +1060,18 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_client_encryption_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys"} # type: ignore + list_sql_containers.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers"} # type: ignore @distributed_trace_async - async def get_client_encryption_key( + async def get_sql_container( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, + container_name: str, **kwargs: Any - ) -> "_models.ClientEncryptionKeyGetResults": - """Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. + ) -> _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. :type resource_group_name: str @@ -980,35 +1079,40 @@ async def get_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. - :type client_encryption_key_name: str + :param container_name: Cosmos DB container name. + :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ClientEncryptionKeyGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults + :return: SqlContainerGetResults, or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientEncryptionKeyGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlContainerGetResults] - request = build_get_client_encryption_key_request( + request = build_get_sql_container_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - client_encryption_key_name=client_encryption_key_name, + container_name=container_name, api_version=api_version, - template_url=self.get_client_encryption_key.metadata['url'], + template_url=self.get_sql_container.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1019,51 +1123,56 @@ async def get_client_encryption_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ClientEncryptionKeyGetResults', pipeline_response) + deserialized = self._deserialize('SqlContainerGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_client_encryption_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore + get_sql_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - async def _create_update_client_encryption_key_initial( + async def _create_update_sql_container_initial( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: "_models.ClientEncryptionKeyCreateUpdateParameters", + container_name: str, + create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, **kwargs: Any - ) -> Optional["_models.ClientEncryptionKeyGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ClientEncryptionKeyGetResults"]] + ) -> Optional[_models.SqlContainerGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(create_update_client_encryption_key_parameters, 'ClientEncryptionKeyCreateUpdateParameters') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlContainerGetResults]] - request = build_create_update_client_encryption_key_request_initial( + _json = self._serialize.body(create_update_sql_container_parameters, 'SqlContainerCreateUpdateParameters') + + request = build_create_update_sql_container_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - client_encryption_key_name=client_encryption_key_name, + container_name=container_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_update_client_encryption_key_initial.metadata['url'], + template_url=self._create_update_sql_container_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1076,28 +1185,27 @@ async def _create_update_client_encryption_key_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ClientEncryptionKeyGetResults', pipeline_response) + deserialized = self._deserialize('SqlContainerGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_update_client_encryption_key_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore + _create_update_sql_container_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore @distributed_trace_async - async def begin_create_update_client_encryption_key( + async def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: "_models.ClientEncryptionKeyCreateUpdateParameters", + container_name: str, + create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.ClientEncryptionKeyGetResults"]: - """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the - Azure Powershell (instead of directly). + ) -> 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. :type resource_group_name: str @@ -1105,12 +1213,12 @@ async def begin_create_update_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters + :param container_name: Cosmos DB container name. + :type container_name: str + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters :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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1119,45 +1227,54 @@ async def begin_create_update_client_encryption_key( :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 ClientEncryptionKeyGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of AsyncLROPoller that returns either SqlContainerGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlContainerGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientEncryptionKeyGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_client_encryption_key_initial( + raw_result = await self._create_update_sql_container_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - client_encryption_key_name=client_encryption_key_name, - create_update_client_encryption_key_parameters=create_update_client_encryption_key_parameters, + container_name=container_name, + create_update_sql_container_parameters=create_update_sql_container_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ClientEncryptionKeyGetResults', pipeline_response) + deserialized = self._deserialize('SqlContainerGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1168,331 +1285,43 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_update_client_encryption_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore - - @distributed_trace - def list_sql_containers( - self, - resource_group_name: str, - account_name: str, - database_name: str, - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlContainerListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_sql_containers_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - api_version=api_version, - template_url=self.list_sql_containers.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_sql_containers_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SqlContainerListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_sql_containers.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers"} # type: ignore - - @distributed_trace_async - async def get_sql_container( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - **kwargs: Any - ) -> "_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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SqlContainerGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_sql_container_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - template_url=self.get_sql_container.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SqlContainerGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_sql_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - + begin_create_update_sql_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - async def _create_update_sql_container_initial( + async def _delete_sql_container_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: "_models.SqlContainerCreateUpdateParameters", **kwargs: Any - ) -> Optional["_models.SqlContainerGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlContainerGetResults"]] + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(create_update_sql_container_parameters, 'SqlContainerCreateUpdateParameters') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - request = build_create_update_sql_container_request_initial( + + request = build_delete_sql_container_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_update_sql_container_initial.metadata['url'], + template_url=self._delete_sql_container_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SqlContainerGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_sql_container_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_update_sql_container( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - create_update_sql_container_parameters: "_models.SqlContainerCreateUpdateParameters", - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. - :type create_update_sql_container_parameters: - ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 SqlContainerGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_update_sql_container_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - create_update_sql_container_parameters=create_update_sql_container_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('SqlContainerGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_sql_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - - async def _delete_sql_container_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_delete_sql_container_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - template_url=self._delete_sql_container_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1504,488 +1333,21 @@ async def _delete_sql_container_initial( # pylint: disable=inconsistent-return- raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_sql_container_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete_sql_container( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_sql_container_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_sql_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - - async def _list_sql_container_partition_merge_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: "_models.MergeParameters", - **kwargs: Any - ) -> Optional["_models.PhysicalPartitionStorageInfoCollection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionStorageInfoCollection"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(merge_parameters, 'MergeParameters') - - request = build_list_sql_container_partition_merge_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._list_sql_container_partition_merge_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _list_sql_container_partition_merge_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge"} # type: ignore - - - @distributed_trace_async - async def begin_list_sql_container_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: "_models.MergeParameters", - **kwargs: Any - ) -> AsyncLROPoller["_models.PhysicalPartitionStorageInfoCollection"]: - """Merges the partitions of a SQL Container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :param merge_parameters: The parameters for the merge operation. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 - PhysicalPartitionStorageInfoCollection or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionStorageInfoCollection"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._list_sql_container_partition_merge_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - merge_parameters=merge_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_list_sql_container_partition_merge.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge"} # type: ignore - - @distributed_trace_async - async def get_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": - """Gets the RUs per second of 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ThroughputSettingsGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_sql_container_throughput_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - template_url=self.get_sql_container_throughput.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_sql_container_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - - async def _update_sql_container_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') - - request = build_update_sql_container_throughput_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_sql_container_throughput_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_sql_container_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_sql_container_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - update_throughput_parameters=update_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_sql_container_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - async def _migrate_sql_container_to_autoscale_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_migrate_sql_container_to_autoscale_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - template_url=self._migrate_sql_container_to_autoscale_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, {}) - _migrate_sql_container_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _delete_sql_container_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore @distributed_trace_async - async def begin_migrate_sql_container_to_autoscale( + async def begin_delete_sql_container( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -2003,42 +1365,48 @@ async def begin_migrate_sql_container_to_autoscale( :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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_sql_container_to_autoscale_initial( + raw_result = await self._delete_sql_container_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -2049,38 +1417,120 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_sql_container_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_delete_sql_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - async def _migrate_sql_container_to_manual_throughput_initial( + @distributed_trace_async + async def get_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of 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. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ThroughputSettingsGetResults, or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :raises: ~azure.core.exceptions.HttpResponseError + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] - request = build_migrate_sql_container_to_manual_throughput_request_initial( + request = build_get_sql_container_throughput_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, api_version=api_version, - template_url=self._migrate_sql_container_to_manual_throughput_initial.metadata['url'], + template_url=self.get_sql_container_throughput.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_sql_container_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore + + + async def _update_sql_container_throughput_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + **kwargs: Any + ) -> Optional[_models.ThroughputSettingsGetResults]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + + _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + request = build_update_sql_container_throughput_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_sql_container_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2100,19 +1550,20 @@ async def _migrate_sql_container_to_manual_throughput_initial( return deserialized - _migrate_sql_container_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _update_sql_container_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore @distributed_trace_async - async def begin_migrate_sql_container_to_manual_throughput( + async def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + ) -> 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. :type resource_group_name: str @@ -2122,6 +1573,10 @@ async def begin_migrate_sql_container_to_manual_throughput( :type database_name: str :param container_name: Cosmos DB container name. :type container_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters :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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -2136,36 +1591,49 @@ async def begin_migrate_sql_container_to_manual_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_sql_container_to_manual_throughput_initial( + raw_result = await self._update_sql_container_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, + update_throughput_parameters=update_throughput_parameters, api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -2176,43 +1644,43 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_sql_container_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_update_sql_container_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - async def _sql_container_retrieve_throughput_distribution_initial( + async def _migrate_sql_container_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - retrieve_throughput_parameters: "_models.RetrieveThroughputParameters", **kwargs: Any - ) -> Optional["_models.PhysicalPartitionThroughputInfoResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionThroughputInfoResult"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(retrieve_throughput_parameters, 'RetrieveThroughputParameters') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - request = build_sql_container_retrieve_throughput_distribution_request_initial( + + request = build_migrate_sql_container_to_autoscale_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._sql_container_retrieve_throughput_distribution_initial.metadata['url'], + template_url=self._migrate_sql_container_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2225,27 +1693,26 @@ async def _sql_container_retrieve_throughput_distribution_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _sql_container_retrieve_throughput_distribution_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore + _migrate_sql_container_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore @distributed_trace_async - async def begin_sql_container_retrieve_throughput_distribution( + async def begin_migrate_sql_container_to_autoscale( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - retrieve_throughput_parameters: "_models.RetrieveThroughputParameters", **kwargs: Any - ) -> AsyncLROPoller["_models.PhysicalPartitionThroughputInfoResult"]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + ) -> 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. :type resource_group_name: str @@ -2255,9 +1722,6 @@ async def begin_sql_container_retrieve_throughput_distribution( :type database_name: str :param container_name: Cosmos DB container name. :type container_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL container. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters :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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -2266,45 +1730,52 @@ async def begin_sql_container_retrieve_throughput_distribution( :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 - PhysicalPartitionThroughputInfoResult or the result of cls(response) + :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionThroughputInfoResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._sql_container_retrieve_throughput_distribution_initial( + raw_result = await self._migrate_sql_container_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -2315,43 +1786,43 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_sql_container_retrieve_throughput_distribution.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore + begin_migrate_sql_container_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - async def _sql_container_redistribute_throughput_initial( + async def _migrate_sql_container_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - redistribute_throughput_parameters: "_models.RedistributeThroughputParameters", **kwargs: Any - ) -> Optional["_models.PhysicalPartitionThroughputInfoResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionThroughputInfoResult"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(redistribute_throughput_parameters, 'RedistributeThroughputParameters') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - request = build_sql_container_redistribute_throughput_request_initial( + + request = build_migrate_sql_container_to_manual_throughput_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._sql_container_redistribute_throughput_initial.metadata['url'], + template_url=self._migrate_sql_container_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2364,27 +1835,26 @@ async def _sql_container_redistribute_throughput_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _sql_container_redistribute_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput"} # type: ignore + _migrate_sql_container_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace_async - async def begin_sql_container_redistribute_throughput( + async def begin_migrate_sql_container_to_manual_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - redistribute_throughput_parameters: "_models.RedistributeThroughputParameters", **kwargs: Any - ) -> AsyncLROPoller["_models.PhysicalPartitionThroughputInfoResult"]: - """Redistribute throughput for an Azure Cosmos DB SQL container. + ) -> 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. :type resource_group_name: str @@ -2394,10 +1864,6 @@ async def begin_sql_container_redistribute_throughput( :type database_name: str :param container_name: Cosmos DB container name. :type container_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL container. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters :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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -2406,45 +1872,52 @@ async def begin_sql_container_redistribute_throughput( :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 - PhysicalPartitionThroughputInfoResult or the result of cls(response) + :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionThroughputInfoResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._sql_container_redistribute_throughput_initial( + raw_result = await self._migrate_sql_container_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -2455,7 +1928,7 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_sql_container_redistribute_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput"} # type: ignore + begin_migrate_sql_container_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace def list_sql_stored_procedures( @@ -2465,7 +1938,7 @@ def list_sql_stored_procedures( database_name: str, container_name: str, **kwargs: Any - ) -> 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. @@ -2483,13 +1956,16 @@ def list_sql_stored_procedures( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlStoredProcedureListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2501,9 +1977,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=self.list_sql_stored_procedures.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2515,9 +1993,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -2559,7 +2039,7 @@ async def get_sql_stored_procedure( container_name: str, stored_procedure_name: str, **kwargs: Any - ) -> "_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. @@ -2577,13 +2057,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlStoredProcedureGetResults] request = build_get_sql_stored_procedure_request( @@ -2595,11 +2078,13 @@ async def get_sql_stored_procedure( stored_procedure_name=stored_procedure_name, api_version=api_version, template_url=self.get_sql_stored_procedure.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2627,17 +2112,20 @@ 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: Any - ) -> Optional["_models.SqlStoredProcedureGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlStoredProcedureGetResults"]] + ) -> Optional[_models.SqlStoredProcedureGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlStoredProcedureGetResults]] _json = self._serialize.body(create_update_sql_stored_procedure_parameters, 'SqlStoredProcedureCreateUpdateParameters') @@ -2652,11 +2140,13 @@ async def _create_update_sql_stored_procedure_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_stored_procedure_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2687,9 +2177,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: Any - ) -> 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. @@ -2720,17 +2210,20 @@ async def begin_create_update_sql_stored_procedure( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlStoredProcedureGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlStoredProcedureGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_sql_stored_procedure_initial( + raw_result = await self._create_update_sql_stored_procedure_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2740,20 +2233,27 @@ async def begin_create_update_sql_stored_procedure( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlStoredProcedureGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -2775,13 +2275,16 @@ async def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent- stored_procedure_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_stored_procedure_request_initial( @@ -2793,11 +2296,13 @@ async def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent- stored_procedure_name=stored_procedure_name, api_version=api_version, template_url=self._delete_sql_stored_procedure_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2848,16 +2353,19 @@ async def begin_delete_sql_stored_procedure( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_sql_stored_procedure_initial( + raw_result = await self._delete_sql_stored_procedure_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2865,6 +2373,8 @@ async def begin_delete_sql_stored_procedure( # pylint: disable=inconsistent-ret stored_procedure_name=stored_procedure_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2874,8 +2384,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -2896,7 +2412,7 @@ def list_sql_user_defined_functions( database_name: str, container_name: str, **kwargs: Any - ) -> 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. @@ -2914,13 +2430,16 @@ def list_sql_user_defined_functions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2932,9 +2451,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=self.list_sql_user_defined_functions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2946,9 +2467,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -2990,7 +2513,7 @@ async def get_sql_user_defined_function( container_name: str, user_defined_function_name: str, **kwargs: Any - ) -> "_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. @@ -3008,13 +2531,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlUserDefinedFunctionGetResults] request = build_get_sql_user_defined_function_request( @@ -3026,11 +2552,13 @@ async def get_sql_user_defined_function( user_defined_function_name=user_defined_function_name, api_version=api_version, template_url=self.get_sql_user_defined_function.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3058,17 +2586,20 @@ 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: Any - ) -> Optional["_models.SqlUserDefinedFunctionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlUserDefinedFunctionGetResults"]] + ) -> Optional[_models.SqlUserDefinedFunctionGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlUserDefinedFunctionGetResults]] _json = self._serialize.body(create_update_sql_user_defined_function_parameters, 'SqlUserDefinedFunctionCreateUpdateParameters') @@ -3083,11 +2614,13 @@ async def _create_update_sql_user_defined_function_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_user_defined_function_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3118,9 +2651,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: Any - ) -> 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. @@ -3151,17 +2684,20 @@ async def begin_create_update_sql_user_defined_function( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlUserDefinedFunctionGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlUserDefinedFunctionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_sql_user_defined_function_initial( + raw_result = await self._create_update_sql_user_defined_function_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3171,20 +2707,27 @@ async def begin_create_update_sql_user_defined_function( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlUserDefinedFunctionGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -3206,13 +2749,16 @@ async def _delete_sql_user_defined_function_initial( # pylint: disable=inconsis user_defined_function_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_user_defined_function_request_initial( @@ -3224,11 +2770,13 @@ async def _delete_sql_user_defined_function_initial( # pylint: disable=inconsis user_defined_function_name=user_defined_function_name, api_version=api_version, template_url=self._delete_sql_user_defined_function_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3279,16 +2827,19 @@ async def begin_delete_sql_user_defined_function( # pylint: disable=inconsisten :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_sql_user_defined_function_initial( + raw_result = await self._delete_sql_user_defined_function_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3296,6 +2847,8 @@ async def begin_delete_sql_user_defined_function( # pylint: disable=inconsisten user_defined_function_name=user_defined_function_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -3305,8 +2858,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -3327,7 +2886,7 @@ def list_sql_triggers( database_name: str, container_name: str, **kwargs: Any - ) -> 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. @@ -3345,13 +2904,16 @@ def list_sql_triggers( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlTriggerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -3363,9 +2925,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=self.list_sql_triggers.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -3377,9 +2941,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -3421,7 +2987,7 @@ async def get_sql_trigger( container_name: str, trigger_name: str, **kwargs: Any - ) -> "_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. @@ -3439,13 +3005,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlTriggerGetResults] request = build_get_sql_trigger_request( @@ -3457,11 +3026,13 @@ async def get_sql_trigger( trigger_name=trigger_name, api_version=api_version, template_url=self.get_sql_trigger.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3489,17 +3060,20 @@ 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: Any - ) -> Optional["_models.SqlTriggerGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlTriggerGetResults"]] + ) -> Optional[_models.SqlTriggerGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlTriggerGetResults]] _json = self._serialize.body(create_update_sql_trigger_parameters, 'SqlTriggerCreateUpdateParameters') @@ -3514,11 +3088,13 @@ async def _create_update_sql_trigger_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_trigger_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3549,9 +3125,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: Any - ) -> 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. @@ -3581,17 +3157,20 @@ async def begin_create_update_sql_trigger( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlTriggerGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlTriggerGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_sql_trigger_initial( + raw_result = await self._create_update_sql_trigger_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3601,20 +3180,27 @@ async def begin_create_update_sql_trigger( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlTriggerGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -3636,13 +3222,16 @@ async def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-st trigger_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_trigger_request_initial( @@ -3654,11 +3243,13 @@ async def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-st trigger_name=trigger_name, api_version=api_version, template_url=self._delete_sql_trigger_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3709,16 +3300,19 @@ async def begin_delete_sql_trigger( # pylint: disable=inconsistent-return-state :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_sql_trigger_initial( + raw_result = await self._delete_sql_trigger_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3726,6 +3320,8 @@ async def begin_delete_sql_trigger( # pylint: disable=inconsistent-return-state trigger_name=trigger_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -3735,8 +3331,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -3756,7 +3358,7 @@ async def get_sql_role_definition( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_models.SqlRoleDefinitionGetResults": + ) -> _models.SqlRoleDefinitionGetResults: """Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. :param role_definition_id: The GUID for the Role Definition. @@ -3770,13 +3372,16 @@ async def get_sql_role_definition( :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleDefinitionGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleDefinitionGetResults] request = build_get_sql_role_definition_request( @@ -3786,11 +3391,13 @@ async def get_sql_role_definition( account_name=account_name, api_version=api_version, template_url=self.get_sql_role_definition.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3816,17 +3423,20 @@ async def _create_update_sql_role_definition_initial( role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: "_models.SqlRoleDefinitionCreateUpdateParameters", + create_update_sql_role_definition_parameters: _models.SqlRoleDefinitionCreateUpdateParameters, **kwargs: Any - ) -> Optional["_models.SqlRoleDefinitionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlRoleDefinitionGetResults"]] + ) -> Optional[_models.SqlRoleDefinitionGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlRoleDefinitionGetResults]] _json = self._serialize.body(create_update_sql_role_definition_parameters, 'SqlRoleDefinitionCreateUpdateParameters') @@ -3839,11 +3449,13 @@ async def _create_update_sql_role_definition_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_role_definition_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3872,9 +3484,9 @@ async def begin_create_update_sql_role_definition( role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: "_models.SqlRoleDefinitionCreateUpdateParameters", + create_update_sql_role_definition_parameters: _models.SqlRoleDefinitionCreateUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.SqlRoleDefinitionGetResults"]: + ) -> AsyncLROPoller[_models.SqlRoleDefinitionGetResults]: """Creates or updates an Azure Cosmos DB SQL Role Definition. :param role_definition_id: The GUID for the Role Definition. @@ -3901,17 +3513,20 @@ async def begin_create_update_sql_role_definition( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleDefinitionGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleDefinitionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_sql_role_definition_initial( + raw_result = await self._create_update_sql_role_definition_initial( # type: ignore role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, @@ -3919,20 +3534,27 @@ async def begin_create_update_sql_role_definition( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlRoleDefinitionGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -3952,13 +3574,16 @@ async def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-r account_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_role_definition_request_initial( @@ -3968,11 +3593,13 @@ async def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-r account_name=account_name, api_version=api_version, template_url=self._delete_sql_role_definition_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4017,21 +3644,26 @@ async def begin_delete_sql_role_definition( # pylint: disable=inconsistent-retu :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_sql_role_definition_initial( + raw_result = await self._delete_sql_role_definition_initial( # type: ignore role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -4041,8 +3673,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -4061,7 +3699,7 @@ def list_sql_role_definitions( resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SqlRoleDefinitionListResult"]: + ) -> AsyncIterable[_models.SqlRoleDefinitionListResult]: """Retrieves the list of all Azure Cosmos DB SQL Role Definitions. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4075,13 +3713,16 @@ def list_sql_role_definitions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -4091,9 +3732,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_sql_role_definitions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -4103,9 +3746,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -4145,7 +3790,7 @@ async def get_sql_role_assignment( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_models.SqlRoleAssignmentGetResults": + ) -> _models.SqlRoleAssignmentGetResults: """Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. :param role_assignment_id: The GUID for the Role Assignment. @@ -4159,13 +3804,16 @@ async def get_sql_role_assignment( :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleAssignmentGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleAssignmentGetResults] request = build_get_sql_role_assignment_request( @@ -4175,11 +3823,13 @@ async def get_sql_role_assignment( account_name=account_name, api_version=api_version, template_url=self.get_sql_role_assignment.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4205,17 +3855,20 @@ async def _create_update_sql_role_assignment_initial( role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: "_models.SqlRoleAssignmentCreateUpdateParameters", + create_update_sql_role_assignment_parameters: _models.SqlRoleAssignmentCreateUpdateParameters, **kwargs: Any - ) -> Optional["_models.SqlRoleAssignmentGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlRoleAssignmentGetResults"]] + ) -> Optional[_models.SqlRoleAssignmentGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlRoleAssignmentGetResults]] _json = self._serialize.body(create_update_sql_role_assignment_parameters, 'SqlRoleAssignmentCreateUpdateParameters') @@ -4228,11 +3881,13 @@ async def _create_update_sql_role_assignment_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_role_assignment_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4261,9 +3916,9 @@ async def begin_create_update_sql_role_assignment( role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: "_models.SqlRoleAssignmentCreateUpdateParameters", + create_update_sql_role_assignment_parameters: _models.SqlRoleAssignmentCreateUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.SqlRoleAssignmentGetResults"]: + ) -> AsyncLROPoller[_models.SqlRoleAssignmentGetResults]: """Creates or updates an Azure Cosmos DB SQL Role Assignment. :param role_assignment_id: The GUID for the Role Assignment. @@ -4290,17 +3945,20 @@ async def begin_create_update_sql_role_assignment( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleAssignmentGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleAssignmentGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_sql_role_assignment_initial( + raw_result = await self._create_update_sql_role_assignment_initial( # type: ignore role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, @@ -4308,20 +3966,27 @@ async def begin_create_update_sql_role_assignment( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlRoleAssignmentGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -4341,13 +4006,16 @@ async def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-r account_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_role_assignment_request_initial( @@ -4357,11 +4025,13 @@ async def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-r account_name=account_name, api_version=api_version, template_url=self._delete_sql_role_assignment_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4406,21 +4076,26 @@ async def begin_delete_sql_role_assignment( # pylint: disable=inconsistent-retu :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_sql_role_assignment_initial( + raw_result = await self._delete_sql_role_assignment_initial( # type: ignore role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -4430,8 +4105,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -4450,7 +4131,7 @@ def list_sql_role_assignments( resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SqlRoleAssignmentListResult"]: + ) -> AsyncIterable[_models.SqlRoleAssignmentListResult]: """Retrieves the list of all Azure Cosmos DB SQL Role Assignments. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4464,13 +4145,16 @@ def list_sql_role_assignments( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleAssignmentListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -4480,9 +4164,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_sql_role_assignments.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -4492,9 +4178,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -4533,17 +4221,20 @@ async def _retrieve_continuous_backup_information_initial( account_name: str, database_name: str, container_name: str, - location: "_models.ContinuousBackupRestoreLocation", + location: _models.ContinuousBackupRestoreLocation, **kwargs: Any - ) -> Optional["_models.BackupInformation"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInformation"]] + ) -> Optional[_models.BackupInformation]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.BackupInformation]] _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') @@ -4557,11 +4248,13 @@ async def _retrieve_continuous_backup_information_initial( content_type=content_type, json=_json, template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4591,9 +4284,9 @@ async def begin_retrieve_continuous_backup_information( account_name: str, database_name: str, container_name: str, - location: "_models.ContinuousBackupRestoreLocation", + location: _models.ContinuousBackupRestoreLocation, **kwargs: Any - ) -> AsyncLROPoller["_models.BackupInformation"]: + ) -> AsyncLROPoller[_models.BackupInformation]: """Retrieves continuous backup information for a container resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4619,17 +4312,20 @@ async def begin_retrieve_continuous_backup_information( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupInformation] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInformation"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._retrieve_continuous_backup_information_initial( + raw_result = await self._retrieve_continuous_backup_information_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4638,20 +4334,27 @@ async def begin_retrieve_continuous_backup_information( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BackupInformation', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_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 daf72d97560a..c2dc9a9ae324 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,35 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._table_resources_operations import build_create_update_table_request_initial, build_delete_table_request_initial, build_get_table_request, build_get_table_throughput_request, build_list_tables_request, build_migrate_table_to_autoscale_request_initial, build_migrate_table_to_manual_throughput_request_initial, build_retrieve_continuous_backup_information_request_initial, build_update_table_throughput_request_initial +from ...operations._table_resources_operations import build_create_update_table_request_initial, build_delete_table_request_initial, build_get_table_request, build_get_table_throughput_request, build_list_tables_request, build_migrate_table_to_autoscale_request_initial, build_migrate_table_to_manual_throughput_request_initial, build_update_table_throughput_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class TableResourcesOperations: - """TableResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`table_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_tables( @@ -53,7 +52,7 @@ def list_tables( resource_group_name: str, account_name: str, **kwargs: Any - ) -> 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. @@ -65,13 +64,16 @@ def list_tables( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -81,9 +83,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_tables.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -93,9 +97,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -135,7 +141,7 @@ async def get_table( account_name: str, table_name: str, **kwargs: Any - ) -> "_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. @@ -149,13 +155,16 @@ async def get_table( :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TableGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TableGetResults] request = build_get_table_request( @@ -165,11 +174,13 @@ async def get_table( table_name=table_name, api_version=api_version, template_url=self.get_table.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -195,17 +206,20 @@ 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: Any - ) -> Optional["_models.TableGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.TableGetResults"]] + ) -> Optional[_models.TableGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.TableGetResults]] _json = self._serialize.body(create_update_table_parameters, 'TableCreateUpdateParameters') @@ -218,11 +232,13 @@ async def _create_update_table_initial( content_type=content_type, json=_json, template_url=self._create_update_table_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -251,9 +267,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: Any - ) -> 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. @@ -277,17 +293,20 @@ async def begin_create_update_table( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TableGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TableGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_update_table_initial( + raw_result = await self._create_update_table_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -295,20 +314,27 @@ async def begin_create_update_table( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('TableGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -328,13 +354,16 @@ async def _delete_table_initial( # pylint: disable=inconsistent-return-statemen table_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_table_request_initial( @@ -344,11 +373,13 @@ async def _delete_table_initial( # pylint: disable=inconsistent-return-statemen table_name=table_name, api_version=api_version, template_url=self._delete_table_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -393,21 +424,26 @@ async def begin_delete_table( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_table_initial( + raw_result = await self._delete_table_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -417,8 +453,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -438,7 +480,7 @@ async def get_table_throughput( account_name: str, table_name: str, **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": + ) -> _models.ThroughputSettingsGetResults: """Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. @@ -453,13 +495,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_table_throughput_request( @@ -469,11 +514,13 @@ async def get_table_throughput( table_name=table_name, api_version=api_version, template_url=self.get_table_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -499,17 +546,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -522,11 +572,13 @@ async def _update_table_throughput_initial( content_type=content_type, json=_json, template_url=self._update_table_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -555,9 +607,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: Any - ) -> 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. @@ -584,17 +636,20 @@ async def begin_update_table_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_table_throughput_initial( + raw_result = await self._update_table_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -602,20 +657,27 @@ async def begin_update_table_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -634,14 +696,17 @@ async def _migrate_table_to_autoscale_initial( account_name: str, table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_table_to_autoscale_request_initial( @@ -651,11 +716,13 @@ async def _migrate_table_to_autoscale_initial( table_name=table_name, api_version=api_version, template_url=self._migrate_table_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -685,7 +752,7 @@ async def begin_migrate_table_to_autoscale( account_name: str, table_name: str, **kwargs: Any - ) -> 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. @@ -708,35 +775,45 @@ async def begin_migrate_table_to_autoscale( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_table_to_autoscale_initial( + raw_result = await self._migrate_table_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -755,14 +832,17 @@ async def _migrate_table_to_manual_throughput_initial( account_name: str, table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_table_to_manual_throughput_request_initial( @@ -772,11 +852,13 @@ async def _migrate_table_to_manual_throughput_initial( table_name=table_name, api_version=api_version, template_url=self._migrate_table_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -806,7 +888,7 @@ async def begin_migrate_table_to_manual_throughput( account_name: str, table_name: str, **kwargs: Any - ) -> 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. @@ -829,166 +911,45 @@ async def begin_migrate_table_to_manual_throughput( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_table_to_manual_throughput_initial( + raw_result = await self._migrate_table_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_table_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - async def _retrieve_continuous_backup_information_initial( - self, - resource_group_name: str, - account_name: str, - table_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> Optional["_models.BackupInformation"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInformation"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') - - request = build_retrieve_continuous_backup_information_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - table_name=table_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupInformation', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _retrieve_continuous_backup_information_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation"} # type: ignore - - - @distributed_trace_async - async def begin_retrieve_continuous_backup_information( - self, - resource_group_name: str, - account_name: str, - table_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> AsyncLROPoller["_models.BackupInformation"]: - """Retrieves continuous backup information for a table. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param table_name: Cosmos DB table name. - :type table_name: str - :param location: The name of the continuous backup restore location. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a 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 BackupInformation or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInformation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._retrieve_continuous_backup_information_initial( - resource_group_name=resource_group_name, - account_name=account_name, - table_name=table_name, - location=location, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BackupInformation', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -999,4 +960,4 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_retrieve_continuous_backup_information.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation"} # type: ignore + begin_migrate_table_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore 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 7dcc99667730..0da8c95ce69a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py @@ -10,16 +10,12 @@ from ._models_py3 import ARMResourceProperties from ._models_py3 import AnalyticalStorageConfiguration from ._models_py3 import ApiProperties -from ._models_py3 import AuthenticationMethodLdapProperties from ._models_py3 import AutoUpgradePolicyResource from ._models_py3 import AutoscaleSettings from ._models_py3 import AutoscaleSettingsResource -from ._models_py3 import AzureBlobDataTransferDataSourceSink from ._models_py3 import BackupInformation from ._models_py3 import BackupPolicy from ._models_py3 import BackupPolicyMigrationState -from ._models_py3 import BackupResource -from ._models_py3 import BackupResourceProperties from ._models_py3 import Capability from ._models_py3 import Capacity from ._models_py3 import CassandraClusterPublicStatus @@ -38,20 +34,7 @@ from ._models_py3 import CassandraTableGetResults from ._models_py3 import CassandraTableListResult from ._models_py3 import CassandraTableResource -from ._models_py3 import CassandraViewCreateUpdateParameters -from ._models_py3 import CassandraViewGetPropertiesOptions -from ._models_py3 import CassandraViewGetPropertiesResource -from ._models_py3 import CassandraViewGetResults -from ._models_py3 import CassandraViewListResult -from ._models_py3 import CassandraViewResource from ._models_py3 import Certificate -from ._models_py3 import ClientEncryptionIncludedPath -from ._models_py3 import ClientEncryptionKeyCreateUpdateParameters -from ._models_py3 import ClientEncryptionKeyGetPropertiesResource -from ._models_py3 import ClientEncryptionKeyGetResults -from ._models_py3 import ClientEncryptionKeyResource -from ._models_py3 import ClientEncryptionKeysListResult -from ._models_py3 import ClientEncryptionPolicy from ._models_py3 import ClusterKey from ._models_py3 import ClusterResource from ._models_py3 import ClusterResourceProperties @@ -68,18 +51,10 @@ from ._models_py3 import ContinuousBackupInformation from ._models_py3 import ContinuousBackupRestoreLocation from ._models_py3 import ContinuousModeBackupPolicy -from ._models_py3 import ContinuousModeProperties from ._models_py3 import CorsPolicy -from ._models_py3 import CosmosCassandraDataTransferDataSourceSink -from ._models_py3 import CosmosSqlDataTransferDataSourceSink -from ._models_py3 import CreateJobRequest from ._models_py3 import CreateUpdateOptions from ._models_py3 import DataCenterResource from ._models_py3 import DataCenterResourceProperties -from ._models_py3 import DataTransferDataSourceSink -from ._models_py3 import DataTransferJobFeedResults -from ._models_py3 import DataTransferJobGetResults -from ._models_py3 import DataTransferJobProperties from ._models_py3 import DataTransferRegionalServiceResource from ._models_py3 import DataTransferServiceResource from ._models_py3 import DataTransferServiceResourceProperties @@ -93,7 +68,6 @@ from ._models_py3 import DatabaseAccountUpdateParameters from ._models_py3 import DatabaseAccountsListResult from ._models_py3 import DatabaseRestoreResource -from ._models_py3 import DiagnosticLogSettings from ._models_py3 import ErrorResponse from ._models_py3 import ExcludedPath from ._models_py3 import ExtendedResourceProperties @@ -102,19 +76,12 @@ from ._models_py3 import GraphAPIComputeRegionalServiceResource from ._models_py3 import GraphAPIComputeServiceResource from ._models_py3 import GraphAPIComputeServiceResourceProperties -from ._models_py3 import GraphResource -from ._models_py3 import GraphResourceCreateUpdateParameters -from ._models_py3 import GraphResourceGetPropertiesOptions -from ._models_py3 import GraphResourceGetPropertiesResource -from ._models_py3 import GraphResourceGetResults -from ._models_py3 import GraphResourcesListResult from ._models_py3 import GremlinDatabaseCreateUpdateParameters from ._models_py3 import GremlinDatabaseGetPropertiesOptions from ._models_py3 import GremlinDatabaseGetPropertiesResource from ._models_py3 import GremlinDatabaseGetResults from ._models_py3 import GremlinDatabaseListResult from ._models_py3 import GremlinDatabaseResource -from ._models_py3 import GremlinDatabaseRestoreResource from ._models_py3 import GremlinGraphCreateUpdateParameters from ._models_py3 import GremlinGraphGetPropertiesOptions from ._models_py3 import GremlinGraphGetPropertiesResource @@ -125,8 +92,6 @@ from ._models_py3 import Indexes from ._models_py3 import IndexingPolicy from ._models_py3 import IpAddressOrRange -from ._models_py3 import KeyWrapMetadata -from ._models_py3 import ListBackups from ._models_py3 import ListClusters from ._models_py3 import ListDataCenters from ._models_py3 import Location @@ -140,7 +105,6 @@ from ._models_py3 import MaterializedViewsBuilderRegionalServiceResource from ._models_py3 import MaterializedViewsBuilderServiceResource from ._models_py3 import MaterializedViewsBuilderServiceResourceProperties -from ._models_py3 import MergeParameters from ._models_py3 import Metric from ._models_py3 import MetricAvailability from ._models_py3 import MetricDefinition @@ -163,12 +127,6 @@ from ._models_py3 import MongoIndex from ._models_py3 import MongoIndexKeys from ._models_py3 import MongoIndexOptions -from ._models_py3 import MongoRoleDefinitionCreateUpdateParameters -from ._models_py3 import MongoRoleDefinitionGetResults -from ._models_py3 import MongoRoleDefinitionListResult -from ._models_py3 import MongoUserDefinitionCreateUpdateParameters -from ._models_py3 import MongoUserDefinitionGetResults -from ._models_py3 import MongoUserDefinitionListResult from ._models_py3 import NotebookWorkspace from ._models_py3 import NotebookWorkspaceConnectionInfoResult from ._models_py3 import NotebookWorkspaceCreateUpdateParameters @@ -187,36 +145,18 @@ from ._models_py3 import PeriodicModeBackupPolicy from ._models_py3 import PeriodicModeProperties from ._models_py3 import Permission -from ._models_py3 import PhysicalPartitionId -from ._models_py3 import PhysicalPartitionStorageInfo -from ._models_py3 import PhysicalPartitionStorageInfoCollection -from ._models_py3 import PhysicalPartitionThroughputInfoProperties -from ._models_py3 import PhysicalPartitionThroughputInfoResource -from ._models_py3 import PhysicalPartitionThroughputInfoResult -from ._models_py3 import PhysicalPartitionThroughputInfoResultPropertiesResource from ._models_py3 import PrivateEndpointConnection 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 Privilege -from ._models_py3 import PrivilegeResource from ._models_py3 import ProxyResource -from ._models_py3 import RedistributeThroughputParameters -from ._models_py3 import RedistributeThroughputPropertiesResource from ._models_py3 import RegionForOnlineOffline from ._models_py3 import RegionalServiceResource from ._models_py3 import Resource from ._models_py3 import RestorableDatabaseAccountGetResult from ._models_py3 import RestorableDatabaseAccountsListResult -from ._models_py3 import RestorableGremlinDatabaseGetResult -from ._models_py3 import RestorableGremlinDatabasePropertiesResource -from ._models_py3 import RestorableGremlinDatabasesListResult -from ._models_py3 import RestorableGremlinGraphGetResult -from ._models_py3 import RestorableGremlinGraphPropertiesResource -from ._models_py3 import RestorableGremlinGraphsListResult -from ._models_py3 import RestorableGremlinResourcesListResult from ._models_py3 import RestorableLocationResource from ._models_py3 import RestorableMongodbCollectionGetResult from ._models_py3 import RestorableMongodbCollectionPropertiesResource @@ -224,6 +164,7 @@ from ._models_py3 import RestorableMongodbDatabaseGetResult from ._models_py3 import RestorableMongodbDatabasePropertiesResource from ._models_py3 import RestorableMongodbDatabasesListResult +from ._models_py3 import RestorableMongodbResourcesGetResult from ._models_py3 import RestorableMongodbResourcesListResult from ._models_py3 import RestorableSqlContainerGetResult from ._models_py3 import RestorableSqlContainerPropertiesResource @@ -233,15 +174,9 @@ from ._models_py3 import RestorableSqlDatabasePropertiesResource from ._models_py3 import RestorableSqlDatabasePropertiesResourceDatabase from ._models_py3 import RestorableSqlDatabasesListResult +from ._models_py3 import RestorableSqlResourcesGetResult from ._models_py3 import RestorableSqlResourcesListResult -from ._models_py3 import RestorableTableGetResult -from ._models_py3 import RestorableTablePropertiesResource -from ._models_py3 import RestorableTableResourcesListResult -from ._models_py3 import RestorableTablesListResult from ._models_py3 import RestoreParameters -from ._models_py3 import RetrieveThroughputParameters -from ._models_py3 import RetrieveThroughputPropertiesResource -from ._models_py3 import Role from ._models_py3 import SeedNode from ._models_py3 import ServiceResource from ._models_py3 import ServiceResourceCreateUpdateParameters @@ -314,20 +249,16 @@ ConflictResolutionMode, ConnectionState, ConnectorOffer, - ContinuousTier, CreateMode, CreatedByType, - DataTransferComponent, DataType, DatabaseAccountKind, DefaultConsistencyLevel, - EnableFullTextQuery, IndexKind, IndexingMode, KeyKind, ManagedCassandraProvisioningState, ManagedCassandraResourceIdentityType, - MongoRoleDefinitionType, NetworkAclBypass, NodeState, NodeStatus, @@ -344,27 +275,24 @@ ServiceStatus, ServiceType, SpatialType, - ThroughputPolicyType, TriggerOperation, TriggerType, UnitType, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ARMProxyResource', 'ARMResourceProperties', 'AnalyticalStorageConfiguration', 'ApiProperties', - 'AuthenticationMethodLdapProperties', 'AutoUpgradePolicyResource', 'AutoscaleSettings', 'AutoscaleSettingsResource', - 'AzureBlobDataTransferDataSourceSink', 'BackupInformation', 'BackupPolicy', 'BackupPolicyMigrationState', - 'BackupResource', - 'BackupResourceProperties', 'Capability', 'Capacity', 'CassandraClusterPublicStatus', @@ -383,20 +311,7 @@ 'CassandraTableGetResults', 'CassandraTableListResult', 'CassandraTableResource', - 'CassandraViewCreateUpdateParameters', - 'CassandraViewGetPropertiesOptions', - 'CassandraViewGetPropertiesResource', - 'CassandraViewGetResults', - 'CassandraViewListResult', - 'CassandraViewResource', 'Certificate', - 'ClientEncryptionIncludedPath', - 'ClientEncryptionKeyCreateUpdateParameters', - 'ClientEncryptionKeyGetPropertiesResource', - 'ClientEncryptionKeyGetResults', - 'ClientEncryptionKeyResource', - 'ClientEncryptionKeysListResult', - 'ClientEncryptionPolicy', 'ClusterKey', 'ClusterResource', 'ClusterResourceProperties', @@ -413,18 +328,10 @@ 'ContinuousBackupInformation', 'ContinuousBackupRestoreLocation', 'ContinuousModeBackupPolicy', - 'ContinuousModeProperties', 'CorsPolicy', - 'CosmosCassandraDataTransferDataSourceSink', - 'CosmosSqlDataTransferDataSourceSink', - 'CreateJobRequest', 'CreateUpdateOptions', 'DataCenterResource', 'DataCenterResourceProperties', - 'DataTransferDataSourceSink', - 'DataTransferJobFeedResults', - 'DataTransferJobGetResults', - 'DataTransferJobProperties', 'DataTransferRegionalServiceResource', 'DataTransferServiceResource', 'DataTransferServiceResourceProperties', @@ -438,7 +345,6 @@ 'DatabaseAccountUpdateParameters', 'DatabaseAccountsListResult', 'DatabaseRestoreResource', - 'DiagnosticLogSettings', 'ErrorResponse', 'ExcludedPath', 'ExtendedResourceProperties', @@ -447,19 +353,12 @@ 'GraphAPIComputeRegionalServiceResource', 'GraphAPIComputeServiceResource', 'GraphAPIComputeServiceResourceProperties', - 'GraphResource', - 'GraphResourceCreateUpdateParameters', - 'GraphResourceGetPropertiesOptions', - 'GraphResourceGetPropertiesResource', - 'GraphResourceGetResults', - 'GraphResourcesListResult', 'GremlinDatabaseCreateUpdateParameters', 'GremlinDatabaseGetPropertiesOptions', 'GremlinDatabaseGetPropertiesResource', 'GremlinDatabaseGetResults', 'GremlinDatabaseListResult', 'GremlinDatabaseResource', - 'GremlinDatabaseRestoreResource', 'GremlinGraphCreateUpdateParameters', 'GremlinGraphGetPropertiesOptions', 'GremlinGraphGetPropertiesResource', @@ -470,8 +369,6 @@ 'Indexes', 'IndexingPolicy', 'IpAddressOrRange', - 'KeyWrapMetadata', - 'ListBackups', 'ListClusters', 'ListDataCenters', 'Location', @@ -485,7 +382,6 @@ 'MaterializedViewsBuilderRegionalServiceResource', 'MaterializedViewsBuilderServiceResource', 'MaterializedViewsBuilderServiceResourceProperties', - 'MergeParameters', 'Metric', 'MetricAvailability', 'MetricDefinition', @@ -508,12 +404,6 @@ 'MongoIndex', 'MongoIndexKeys', 'MongoIndexOptions', - 'MongoRoleDefinitionCreateUpdateParameters', - 'MongoRoleDefinitionGetResults', - 'MongoRoleDefinitionListResult', - 'MongoUserDefinitionCreateUpdateParameters', - 'MongoUserDefinitionGetResults', - 'MongoUserDefinitionListResult', 'NotebookWorkspace', 'NotebookWorkspaceConnectionInfoResult', 'NotebookWorkspaceCreateUpdateParameters', @@ -532,36 +422,18 @@ 'PeriodicModeBackupPolicy', 'PeriodicModeProperties', 'Permission', - 'PhysicalPartitionId', - 'PhysicalPartitionStorageInfo', - 'PhysicalPartitionStorageInfoCollection', - 'PhysicalPartitionThroughputInfoProperties', - 'PhysicalPartitionThroughputInfoResource', - 'PhysicalPartitionThroughputInfoResult', - 'PhysicalPartitionThroughputInfoResultPropertiesResource', 'PrivateEndpointConnection', 'PrivateEndpointConnectionListResult', 'PrivateEndpointProperty', 'PrivateLinkResource', 'PrivateLinkResourceListResult', 'PrivateLinkServiceConnectionStateProperty', - 'Privilege', - 'PrivilegeResource', 'ProxyResource', - 'RedistributeThroughputParameters', - 'RedistributeThroughputPropertiesResource', 'RegionForOnlineOffline', 'RegionalServiceResource', 'Resource', 'RestorableDatabaseAccountGetResult', 'RestorableDatabaseAccountsListResult', - 'RestorableGremlinDatabaseGetResult', - 'RestorableGremlinDatabasePropertiesResource', - 'RestorableGremlinDatabasesListResult', - 'RestorableGremlinGraphGetResult', - 'RestorableGremlinGraphPropertiesResource', - 'RestorableGremlinGraphsListResult', - 'RestorableGremlinResourcesListResult', 'RestorableLocationResource', 'RestorableMongodbCollectionGetResult', 'RestorableMongodbCollectionPropertiesResource', @@ -569,6 +441,7 @@ 'RestorableMongodbDatabaseGetResult', 'RestorableMongodbDatabasePropertiesResource', 'RestorableMongodbDatabasesListResult', + 'RestorableMongodbResourcesGetResult', 'RestorableMongodbResourcesListResult', 'RestorableSqlContainerGetResult', 'RestorableSqlContainerPropertiesResource', @@ -578,15 +451,9 @@ 'RestorableSqlDatabasePropertiesResource', 'RestorableSqlDatabasePropertiesResourceDatabase', 'RestorableSqlDatabasesListResult', + 'RestorableSqlResourcesGetResult', 'RestorableSqlResourcesListResult', - 'RestorableTableGetResult', - 'RestorableTablePropertiesResource', - 'RestorableTableResourcesListResult', - 'RestorableTablesListResult', 'RestoreParameters', - 'RetrieveThroughputParameters', - 'RetrieveThroughputPropertiesResource', - 'Role', 'SeedNode', 'ServiceResource', 'ServiceResourceCreateUpdateParameters', @@ -656,20 +523,16 @@ 'ConflictResolutionMode', 'ConnectionState', 'ConnectorOffer', - 'ContinuousTier', 'CreateMode', 'CreatedByType', - 'DataTransferComponent', 'DataType', 'DatabaseAccountKind', 'DefaultConsistencyLevel', - 'EnableFullTextQuery', 'IndexKind', 'IndexingMode', 'KeyKind', 'ManagedCassandraProvisioningState', 'ManagedCassandraResourceIdentityType', - 'MongoRoleDefinitionType', 'NetworkAclBypass', 'NodeState', 'NodeStatus', @@ -686,8 +549,9 @@ 'ServiceStatus', 'ServiceType', 'SpatialType', - 'ThroughputPolicyType', 'TriggerOperation', 'TriggerType', 'UnitType', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 c8e6f111d4e0..47367f22d0f1 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 @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AnalyticalStorageSchemaType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AnalyticalStorageSchemaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the types of schema for analytical storage. """ WELL_DEFINED = "WellDefined" FULL_FIDELITY = "FullFidelity" -class ApiType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to indicate the API type of the restorable database account. """ @@ -29,17 +28,16 @@ class ApiType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SQL = "Sql" GREMLIN_V2 = "GremlinV2" -class AuthenticationMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default - password based authentication. The default is 'Cassandra'. 'Ldap' is in preview. + password based authentication. The default is 'Cassandra'. """ NONE = "None" CASSANDRA = "Cassandra" - LDAP = "Ldap" -class BackupPolicyMigrationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BackupPolicyMigrationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the status of migration between backup policy types. """ @@ -48,14 +46,14 @@ class BackupPolicyMigrationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, E COMPLETED = "Completed" FAILED = "Failed" -class BackupPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BackupPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the mode of backups. """ PERIODIC = "Periodic" CONTINUOUS = "Continuous" -class BackupStorageRedundancy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BackupStorageRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to indicate type of backup storage redundancy. """ @@ -63,21 +61,21 @@ class BackupStorageRedundancy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) LOCAL = "Local" ZONE = "Zone" -class CompositePathSortOrder(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CompositePathSortOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sort order for composite paths. """ ASCENDING = "ascending" DESCENDING = "descending" -class ConflictResolutionMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConflictResolutionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the conflict resolution mode. """ LAST_WRITER_WINS = "LastWriterWins" CUSTOM = "Custom" -class ConnectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of connection error that occurred. """ @@ -88,20 +86,13 @@ class ConnectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INTERNAL_OPERATOR_TO_DATA_CENTER_CERTIFICATE_ERROR = "InternalOperatorToDataCenterCertificateError" INTERNAL_ERROR = "InternalError" -class ConnectorOffer(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectorOffer(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The cassandra connector offer type for the Cosmos DB C* database account. """ SMALL = "Small" -class ContinuousTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Enum to indicate type of Continuous backup tier. - """ - - CONTINUOUS7_DAYS = "Continuous7Days" - CONTINUOUS30_DAYS = "Continuous30Days" - -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -110,14 +101,14 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to indicate the mode of account creation. """ DEFAULT = "Default" RESTORE = "Restore" -class DatabaseAccountKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DatabaseAccountKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the type of database account. This can only be set at database account creation. """ @@ -125,13 +116,7 @@ class DatabaseAccountKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MONGO_DB = "MongoDB" PARSE = "Parse" -class DataTransferComponent(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - - COSMOS_DB_CASSANDRA = "CosmosDBCassandra" - COSMOS_DB_SQL = "CosmosDBSql" - AZURE_BLOB_STORAGE = "AzureBlobStorage" - -class DataType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The datatype for which the indexing behavior is applied to. """ @@ -142,7 +127,7 @@ class DataType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LINE_STRING = "LineString" MULTI_POLYGON = "MultiPolygon" -class DefaultConsistencyLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DefaultConsistencyLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default consistency level and configuration settings of the Cosmos DB account. """ @@ -152,15 +137,7 @@ class DefaultConsistencyLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) STRONG = "Strong" CONSISTENT_PREFIX = "ConsistentPrefix" -class EnableFullTextQuery(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describe the level of detail with which queries are to be logged. - """ - - NONE = "None" - TRUE = "True" - FALSE = "False" - -class IndexingMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IndexingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the indexing mode. """ @@ -168,7 +145,7 @@ class IndexingMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LAZY = "lazy" NONE = "none" -class IndexKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IndexKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the type of index. """ @@ -176,7 +153,7 @@ class IndexKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RANGE = "Range" SPATIAL = "Spatial" -class KeyKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The access key to regenerate. """ @@ -185,7 +162,7 @@ class KeyKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PRIMARY_READONLY = "primaryReadonly" SECONDARY_READONLY = "secondaryReadonly" -class ManagedCassandraProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedCassandraProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the resource at the time the operation was called. """ @@ -196,28 +173,21 @@ class ManagedCassandraProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, FAILED = "Failed" CANCELED = "Canceled" -class ManagedCassandraResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedCassandraResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the resource. """ SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class MongoRoleDefinitionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Indicates whether the Role Definition was built-in or user created. - """ - - BUILT_IN_ROLE = "BuiltInRole" - CUSTOM_ROLE = "CustomRole" - -class NetworkAclBypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAclBypass(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates what services are allowed to bypass firewall checks. """ NONE = "None" AZURE_SERVICES = "AzureServices" -class NodeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NodeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The state of the node in Cassandra ring. """ @@ -227,18 +197,18 @@ class NodeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MOVING = "Moving" STOPPED = "Stopped" -class NodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NodeStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether the node is functioning or not. """ UP = "Up" DOWN = "Down" -class NotebookWorkspaceName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NotebookWorkspaceName(str, Enum, metaclass=CaseInsensitiveEnumMeta): DEFAULT = "default" -class OperationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to indicate the operation type of the event. """ @@ -247,7 +217,7 @@ class OperationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "Delete" SYSTEM_OPERATION = "SystemOperation" -class PartitionKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PartitionKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create """ @@ -256,7 +226,7 @@ class PartitionKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RANGE = "Range" MULTI_HASH = "MultiHash" -class PrimaryAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrimaryAggregationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The primary aggregation type of the metric. """ @@ -267,14 +237,14 @@ class PrimaryAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) MAXIMUM = "Maximum" LAST = "Last" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether requests from Public Network are allowed """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -285,20 +255,20 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" NONE = "None" -class RestoreMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RestoreMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the mode of the restore. """ POINT_IN_TIME = "PointInTime" -class RoleDefinitionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RoleDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether the Role Definition was built-in or user created. """ BUILT_IN_ROLE = "BuiltInRole" CUSTOM_ROLE = "CustomRole" -class ServerVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServerVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the ServerVersion of an a MongoDB account. """ @@ -307,7 +277,7 @@ class ServerVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOUR0 = "4.0" FOUR2 = "4.2" -class ServiceSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServiceSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Instance type for the service. """ @@ -315,7 +285,7 @@ class ServiceSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COSMOS_D8_S = "Cosmos.D8s" COSMOS_D16_S = "Cosmos.D16s" -class ServiceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServiceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the status of a service. """ @@ -326,7 +296,7 @@ class ServiceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ERROR = "Error" STOPPED = "Stopped" -class ServiceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServiceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ServiceType for the service. """ @@ -335,7 +305,7 @@ class ServiceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GRAPH_API_COMPUTE = "GraphAPICompute" MATERIALIZED_VIEWS_BUILDER = "MaterializedViewsBuilder" -class SpatialType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SpatialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the spatial type of index. """ @@ -344,15 +314,7 @@ class SpatialType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): POLYGON = "Polygon" MULTI_POLYGON = "MultiPolygon" -class ThroughputPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """ThroughputPolicy to apply for throughput redistribution - """ - - NONE = "none" - EQUAL = "equal" - CUSTOM = "custom" - -class TriggerOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TriggerOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation the trigger is associated with """ @@ -362,14 +324,14 @@ class TriggerOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "Delete" REPLACE = "Replace" -class TriggerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the Trigger """ PRE = "Pre" POST = "Post" -class UnitType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UnitType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The unit of the metric. """ 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 ae29bf02b433..8dcd39e88f8b 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 @@ -7,19 +7,21 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._cosmos_db_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AnalyticalStorageConfiguration(msrest.serialization.Model): """Analytical storage specific properties. - :ivar schema_type: Describes the types of schema for analytical storage. Possible values - include: "WellDefined", "FullFidelity". + :ivar schema_type: Describes the types of schema for analytical storage. Known values are: + "WellDefined", "FullFidelity". :vartype schema_type: str or ~azure.mgmt.cosmosdb.models.AnalyticalStorageSchemaType """ @@ -30,12 +32,12 @@ class AnalyticalStorageConfiguration(msrest.serialization.Model): def __init__( self, *, - schema_type: Optional[Union[str, "AnalyticalStorageSchemaType"]] = None, + schema_type: Optional[Union[str, "_models.AnalyticalStorageSchemaType"]] = None, **kwargs ): """ - :keyword schema_type: Describes the types of schema for analytical storage. Possible values - include: "WellDefined", "FullFidelity". + :keyword schema_type: Describes the types of schema for analytical storage. Known values are: + "WellDefined", "FullFidelity". :paramtype schema_type: str or ~azure.mgmt.cosmosdb.models.AnalyticalStorageSchemaType """ super(AnalyticalStorageConfiguration, self).__init__(**kwargs) @@ -45,8 +47,8 @@ def __init__( class ApiProperties(msrest.serialization.Model): """ApiProperties. - :ivar server_version: Describes the ServerVersion of an a MongoDB account. Possible values - include: "3.2", "3.6", "4.0", "4.2". + :ivar server_version: Describes the ServerVersion of an a MongoDB account. Known values are: + "3.2", "3.6", "4.0", "4.2". :vartype server_version: str or ~azure.mgmt.cosmosdb.models.ServerVersion """ @@ -57,12 +59,12 @@ class ApiProperties(msrest.serialization.Model): def __init__( self, *, - server_version: Optional[Union[str, "ServerVersion"]] = None, + server_version: Optional[Union[str, "_models.ServerVersion"]] = None, **kwargs ): """ - :keyword server_version: Describes the ServerVersion of an a MongoDB account. Possible values - include: "3.2", "3.6", "4.0", "4.2". + :keyword server_version: Describes the ServerVersion of an a MongoDB account. Known values are: + "3.2", "3.6", "4.0", "4.2". :paramtype server_version: str or ~azure.mgmt.cosmosdb.models.ServerVersion """ super(ApiProperties, self).__init__(**kwargs) @@ -126,8 +128,6 @@ class ARMResourceProperties(msrest.serialization.Model): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity """ _validation = { @@ -142,7 +142,6 @@ class ARMResourceProperties(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } def __init__( @@ -150,7 +149,6 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, **kwargs ): """ @@ -163,8 +161,6 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity """ super(ARMResourceProperties, self).__init__(**kwargs) self.id = None @@ -172,80 +168,6 @@ def __init__( self.type = None self.location = location self.tags = tags - self.identity = identity - - -class AuthenticationMethodLdapProperties(msrest.serialization.Model): - """Ldap authentication method properties. This feature is in preview. - - :ivar server_hostname: Hostname of the LDAP server. - :vartype server_hostname: str - :ivar server_port: Port of the LDAP server. - :vartype server_port: int - :ivar service_user_distinguished_name: Distinguished name of the look up user account, who can - look up user details on authentication. - :vartype service_user_distinguished_name: str - :ivar service_user_password: Password of the look up user. - :vartype service_user_password: str - :ivar search_base_distinguished_name: Distinguished name of the object to start the recursive - search of users from. - :vartype search_base_distinguished_name: str - :ivar search_filter_template: Template to use for searching. Defaults to (cn=%s) where %s will - be replaced by the username used to login. - :vartype search_filter_template: str - :ivar server_certificates: - :vartype server_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] - """ - - _attribute_map = { - 'server_hostname': {'key': 'serverHostname', 'type': 'str'}, - 'server_port': {'key': 'serverPort', 'type': 'int'}, - 'service_user_distinguished_name': {'key': 'serviceUserDistinguishedName', 'type': 'str'}, - 'service_user_password': {'key': 'serviceUserPassword', 'type': 'str'}, - 'search_base_distinguished_name': {'key': 'searchBaseDistinguishedName', 'type': 'str'}, - 'search_filter_template': {'key': 'searchFilterTemplate', 'type': 'str'}, - 'server_certificates': {'key': 'serverCertificates', 'type': '[Certificate]'}, - } - - def __init__( - self, - *, - server_hostname: Optional[str] = None, - server_port: Optional[int] = None, - service_user_distinguished_name: Optional[str] = None, - service_user_password: Optional[str] = None, - search_base_distinguished_name: Optional[str] = None, - search_filter_template: Optional[str] = None, - server_certificates: Optional[List["Certificate"]] = None, - **kwargs - ): - """ - :keyword server_hostname: Hostname of the LDAP server. - :paramtype server_hostname: str - :keyword server_port: Port of the LDAP server. - :paramtype server_port: int - :keyword service_user_distinguished_name: Distinguished name of the look up user account, who - can look up user details on authentication. - :paramtype service_user_distinguished_name: str - :keyword service_user_password: Password of the look up user. - :paramtype service_user_password: str - :keyword search_base_distinguished_name: Distinguished name of the object to start the - recursive search of users from. - :paramtype search_base_distinguished_name: str - :keyword search_filter_template: Template to use for searching. Defaults to (cn=%s) where %s - will be replaced by the username used to login. - :paramtype search_filter_template: str - :keyword server_certificates: - :paramtype server_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] - """ - super(AuthenticationMethodLdapProperties, self).__init__(**kwargs) - self.server_hostname = server_hostname - self.server_port = server_port - self.service_user_distinguished_name = service_user_distinguished_name - self.service_user_password = service_user_password - self.search_base_distinguished_name = search_base_distinguished_name - self.search_filter_template = search_filter_template - self.server_certificates = server_certificates class AutoscaleSettings(msrest.serialization.Model): @@ -304,7 +226,7 @@ def __init__( self, *, max_throughput: int, - auto_upgrade_policy: Optional["AutoUpgradePolicyResource"] = None, + auto_upgrade_policy: Optional["_models.AutoUpgradePolicyResource"] = None, **kwargs ): """ @@ -334,7 +256,7 @@ class AutoUpgradePolicyResource(msrest.serialization.Model): def __init__( self, *, - throughput_policy: Optional["ThroughputPolicyResource"] = None, + throughput_policy: Optional["_models.ThroughputPolicyResource"] = None, **kwargs ): """ @@ -346,85 +268,6 @@ def __init__( self.throughput_policy = throughput_policy -class DataTransferDataSourceSink(msrest.serialization.Model): - """Base class for all DataTransfer source/sink. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureBlobDataTransferDataSourceSink, CosmosCassandraDataTransferDataSourceSink, CosmosSqlDataTransferDataSourceSink. - - All required parameters must be populated in order to send to Azure. - - :ivar component: Required. Constant filled by server. Possible values include: - "CosmosDBCassandra", "CosmosDBSql", "AzureBlobStorage". Default value: "CosmosDBCassandra". - :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent - """ - - _validation = { - 'component': {'required': True}, - } - - _attribute_map = { - 'component': {'key': 'component', 'type': 'str'}, - } - - _subtype_map = { - 'component': {'AzureBlobStorage': 'AzureBlobDataTransferDataSourceSink', 'CosmosDBCassandra': 'CosmosCassandraDataTransferDataSourceSink', 'CosmosDBSql': 'CosmosSqlDataTransferDataSourceSink'} - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DataTransferDataSourceSink, self).__init__(**kwargs) - self.component = None # type: Optional[str] - - -class AzureBlobDataTransferDataSourceSink(DataTransferDataSourceSink): - """An Azure Blob Storage data source/sink. - - All required parameters must be populated in order to send to Azure. - - :ivar component: Required. Constant filled by server. Possible values include: - "CosmosDBCassandra", "CosmosDBSql", "AzureBlobStorage". Default value: "CosmosDBCassandra". - :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent - :ivar container_name: Required. - :vartype container_name: str - :ivar endpoint_url: - :vartype endpoint_url: str - """ - - _validation = { - 'component': {'required': True}, - 'container_name': {'required': True}, - } - - _attribute_map = { - 'component': {'key': 'component', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'endpoint_url': {'key': 'endpointUrl', 'type': 'str'}, - } - - def __init__( - self, - *, - container_name: str, - endpoint_url: Optional[str] = None, - **kwargs - ): - """ - :keyword container_name: Required. - :paramtype container_name: str - :keyword endpoint_url: - :paramtype endpoint_url: str - """ - super(AzureBlobDataTransferDataSourceSink, self).__init__(**kwargs) - self.component = 'AzureBlobStorage' # type: str - self.container_name = container_name - self.endpoint_url = endpoint_url - - class BackupInformation(msrest.serialization.Model): """Backup information of a resource. @@ -460,8 +303,8 @@ class BackupPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Describes the mode of backups.Constant filled by server. Possible values - include: "Periodic", "Continuous". + :ivar type: Required. Describes the mode of backups.Constant filled by server. Known values + are: "Periodic", "Continuous". :vartype type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType :ivar migration_state: The object representing the state of the migration between the backup policies. @@ -484,7 +327,7 @@ class BackupPolicy(msrest.serialization.Model): def __init__( self, *, - migration_state: Optional["BackupPolicyMigrationState"] = None, + migration_state: Optional["_models.BackupPolicyMigrationState"] = None, **kwargs ): """ @@ -500,11 +343,11 @@ def __init__( class BackupPolicyMigrationState(msrest.serialization.Model): """The object representing the state of the migration between the backup policies. - :ivar status: Describes the status of migration between backup policy types. Possible values - include: "Invalid", "InProgress", "Completed", "Failed". + :ivar status: Describes the status of migration between backup policy types. Known values are: + "Invalid", "InProgress", "Completed", "Failed". :vartype status: str or ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationStatus :ivar target_type: Describes the target backup policy type of the backup policy migration. - Possible values include: "Periodic", "Continuous". + Known values are: "Periodic", "Continuous". :vartype target_type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType :ivar start_time: Time at which the backup policy migration started (ISO-8601 format). :vartype start_time: ~datetime.datetime @@ -519,17 +362,17 @@ class BackupPolicyMigrationState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "BackupPolicyMigrationStatus"]] = None, - target_type: Optional[Union[str, "BackupPolicyType"]] = None, + status: Optional[Union[str, "_models.BackupPolicyMigrationStatus"]] = None, + target_type: Optional[Union[str, "_models.BackupPolicyType"]] = None, start_time: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword status: Describes the status of migration between backup policy types. Possible values - include: "Invalid", "InProgress", "Completed", "Failed". + :keyword status: Describes the status of migration between backup policy types. Known values + are: "Invalid", "InProgress", "Completed", "Failed". :paramtype status: str or ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationStatus :keyword target_type: Describes the target backup policy type of the backup policy migration. - Possible values include: "Periodic", "Continuous". + Known values are: "Periodic", "Continuous". :paramtype target_type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType :keyword start_time: Time at which the backup policy migration started (ISO-8601 format). :paramtype start_time: ~datetime.datetime @@ -540,73 +383,6 @@ def __init__( self.start_time = start_time -class BackupResource(ARMProxyResource): - """A restorable backup of a Cassandra cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar properties: - :vartype properties: ~azure.mgmt.cosmosdb.models.BackupResourceProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BackupResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BackupResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: - :paramtype properties: ~azure.mgmt.cosmosdb.models.BackupResourceProperties - """ - super(BackupResource, self).__init__(**kwargs) - self.properties = properties - - -class BackupResourceProperties(msrest.serialization.Model): - """BackupResourceProperties. - - :ivar timestamp: The time this backup was taken, formatted like 2021-01-21T17:35:21. - :vartype timestamp: ~datetime.datetime - """ - - _attribute_map = { - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - timestamp: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword timestamp: The time this backup was taken, formatted like 2021-01-21T17:35:21. - :paramtype timestamp: ~datetime.datetime - """ - super(BackupResourceProperties, self).__init__(**kwargs) - self.timestamp = timestamp - - class Capability(msrest.serialization.Model): """Cosmos DB capability object. @@ -695,9 +471,9 @@ def __init__( self, *, e_tag: Optional[str] = None, - reaper_status: Optional["ManagedCassandraReaperStatus"] = None, - connection_errors: Optional[List["ConnectionError"]] = None, - data_centers: Optional[List["CassandraClusterPublicStatusDataCentersItem"]] = None, + reaper_status: Optional["_models.ManagedCassandraReaperStatus"] = None, + connection_errors: Optional[List["_models.ConnectionError"]] = None, + data_centers: Optional[List["_models.CassandraClusterPublicStatusDataCentersItem"]] = None, **kwargs ): """ @@ -742,7 +518,7 @@ def __init__( *, name: Optional[str] = None, seed_nodes: Optional[List[str]] = None, - nodes: Optional[List["ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems"]] = None, + nodes: Optional[List["_models.ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems"]] = None, **kwargs ): """ @@ -782,8 +558,6 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: Required. The standard JSON format of a Cassandra keyspace. :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -804,7 +578,6 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } @@ -812,11 +585,10 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - resource: "CassandraKeyspaceResource", + resource: "_models.CassandraKeyspaceResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ @@ -829,15 +601,13 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: Required. The standard JSON format of a Cassandra keyspace. :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(CassandraKeyspaceCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -861,7 +631,7 @@ def __init__( self, *, throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, **kwargs ): """ @@ -895,7 +665,7 @@ def __init__( self, *, throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, **kwargs ): """ @@ -1046,8 +816,6 @@ class CassandraKeyspaceGetResults(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetPropertiesResource :ivar options: @@ -1066,7 +834,6 @@ class CassandraKeyspaceGetResults(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceGetPropertiesResource'}, 'options': {'key': 'properties.options', 'type': 'CassandraKeyspaceGetPropertiesOptions'}, } @@ -1076,9 +843,8 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["CassandraKeyspaceGetPropertiesResource"] = None, - options: Optional["CassandraKeyspaceGetPropertiesOptions"] = None, + resource: Optional["_models.CassandraKeyspaceGetPropertiesResource"] = None, + options: Optional["_models.CassandraKeyspaceGetPropertiesOptions"] = None, **kwargs ): """ @@ -1091,14 +857,12 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetPropertiesOptions """ - super(CassandraKeyspaceGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(CassandraKeyspaceGetResults, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -1175,9 +939,9 @@ class CassandraSchema(msrest.serialization.Model): def __init__( self, *, - columns: Optional[List["Column"]] = None, - partition_keys: Optional[List["CassandraPartitionKey"]] = None, - cluster_keys: Optional[List["ClusterKey"]] = None, + columns: Optional[List["_models.Column"]] = None, + partition_keys: Optional[List["_models.CassandraPartitionKey"]] = None, + cluster_keys: Optional[List["_models.ClusterKey"]] = None, **kwargs ): """ @@ -1216,8 +980,6 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: Required. The standard JSON format of a Cassandra table. :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraTableResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -1238,7 +1000,6 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } @@ -1246,11 +1007,10 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - resource: "CassandraTableResource", + resource: "_models.CassandraTableResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ @@ -1263,15 +1023,13 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: Required. The standard JSON format of a Cassandra table. :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraTableResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(CassandraTableCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(CassandraTableCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -1295,7 +1053,7 @@ def __init__( self, *, throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, **kwargs ): """ @@ -1339,7 +1097,7 @@ def __init__( *, id: str, default_ttl: Optional[int] = None, - schema: Optional["CassandraSchema"] = None, + schema: Optional["_models.CassandraSchema"] = None, analytical_storage_ttl: Optional[int] = None, **kwargs ): @@ -1406,7 +1164,7 @@ def __init__( *, id: str, default_ttl: Optional[int] = None, - schema: Optional["CassandraSchema"] = None, + schema: Optional["_models.CassandraSchema"] = None, analytical_storage_ttl: Optional[int] = None, **kwargs ): @@ -1450,8 +1208,6 @@ class CassandraTableGetResults(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesResource :ivar options: @@ -1470,7 +1226,6 @@ class CassandraTableGetResults(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'CassandraTableGetPropertiesResource'}, 'options': {'key': 'properties.options', 'type': 'CassandraTableGetPropertiesOptions'}, } @@ -1480,9 +1235,8 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["CassandraTableGetPropertiesResource"] = None, - options: Optional["CassandraTableGetPropertiesOptions"] = None, + resource: Optional["_models.CassandraTableGetPropertiesResource"] = None, + options: Optional["_models.CassandraTableGetPropertiesOptions"] = None, **kwargs ): """ @@ -1495,14 +1249,12 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesOptions """ - super(CassandraTableGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(CassandraTableGetResults, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -1534,12 +1286,69 @@ def __init__( self.value = None -class CassandraViewCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Cassandra view. +class Certificate(msrest.serialization.Model): + """Certificate. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar pem: PEM formatted public key. + :vartype pem: str + """ - All required parameters must be populated in order to send to Azure. + _attribute_map = { + 'pem': {'key': 'pem', 'type': 'str'}, + } + + def __init__( + self, + *, + pem: Optional[str] = None, + **kwargs + ): + """ + :keyword pem: PEM formatted public key. + :paramtype pem: str + """ + super(Certificate, self).__init__(**kwargs) + self.pem = pem + + +class ClusterKey(msrest.serialization.Model): + """Cosmos DB Cassandra table cluster key. + + :ivar name: Name of the Cosmos DB Cassandra table cluster key. + :vartype name: str + :ivar order_by: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and + "Desc". + :vartype order_by: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'order_by': {'key': 'orderBy', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + order_by: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the Cosmos DB Cassandra table cluster key. + :paramtype name: str + :keyword order_by: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and + "Desc". + :paramtype order_by: str + """ + super(ClusterKey, self).__init__(**kwargs) + self.name = name + self.order_by = order_by + + +class ManagedCassandraARMResourceProperties(msrest.serialization.Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: The unique resource identifier of the ARM resource. :vartype id: str @@ -1557,19 +1366,13 @@ class CassandraViewCreateUpdateParameters(ARMResourceProperties): include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: Required. The standard JSON format of a Cassandra view. - :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraViewResource - :ivar options: A key-value pair of options to be applied for the request. This corresponds to - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedCassandraManagedServiceIdentity """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource': {'required': True}, } _attribute_map = { @@ -1578,19 +1381,15 @@ class CassandraViewCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'CassandraViewResource'}, - 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, + 'identity': {'key': 'identity', 'type': 'ManagedCassandraManagedServiceIdentity'}, } def __init__( self, *, - resource: "CassandraViewResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, **kwargs ): """ @@ -1604,238 +1403,420 @@ def __init__( also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: Required. The standard JSON format of a Cassandra view. - :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraViewResource - :keyword options: A key-value pair of options to be applied for the request. This corresponds - to the headers sent with the request. - :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedCassandraManagedServiceIdentity """ - super(CassandraViewCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options + super(ManagedCassandraARMResourceProperties, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.identity = identity -class CassandraViewGetPropertiesOptions(OptionsResource): - """CassandraViewGetPropertiesOptions. +class ClusterResource(ManagedCassandraARMResourceProperties): + """Representation of a managed Cassandra cluster. - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These + tags can be used in viewing and grouping this resource (across resource groups). A maximum of + 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters + and value no greater than 256 characters. For example, the default experience for a template + type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also + include "Table", "Graph", "DocumentDB", and "MongoDB". + :vartype tags: dict[str, str] + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedCassandraManagedServiceIdentity + :ivar properties: Properties of a managed Cassandra cluster. + :vartype properties: ~azure.mgmt.cosmosdb.models.ClusterResourceProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + _attribute_map = { - 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedCassandraManagedServiceIdentity'}, + 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, } def __init__( self, *, - throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, + properties: Optional["_models.ClusterResourceProperties"] = None, **kwargs ): """ - :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :paramtype throughput: int - :keyword autoscale_settings: Specifies the Autoscale settings. - :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedCassandraManagedServiceIdentity + :keyword properties: Properties of a managed Cassandra cluster. + :paramtype properties: ~azure.mgmt.cosmosdb.models.ClusterResourceProperties """ - super(CassandraViewGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) + super(ClusterResource, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + self.properties = properties -class CassandraViewResource(msrest.serialization.Model): - """Cosmos DB Cassandra view resource object. +class ClusterResourceProperties(msrest.serialization.Model): + """Properties of a managed Cassandra cluster. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Required. Name of the Cosmos DB Cassandra view. - :vartype id: str - :ivar view_definition: Required. View Definition of the Cosmos DB Cassandra view. - :vartype view_definition: str + :ivar provisioning_state: The status of the resource at the time the operation was called. + Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.cosmosdb.models.ManagedCassandraProvisioningState + :ivar restore_from_backup_id: To create an empty cluster, omit this field or set it to null. To + restore a backup into a new cluster, set this field to the resource id of the backup. + :vartype restore_from_backup_id: str + :ivar delegated_management_subnet_id: Resource id of a subnet that this cluster's management + service should have its network interface attached to. The subnet must be routable to all + subnets that will be delegated to data centers. The resource id must be of the form + '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/virtualNetworks/:code:``/subnets/:code:``'. + :vartype delegated_management_subnet_id: str + :ivar cassandra_version: Which version of Cassandra should this cluster converge to running + (e.g., 3.11). When updated, the cluster may take some time to migrate to the new version. + :vartype cassandra_version: str + :ivar cluster_name_override: If you need to set the clusterName property in cassandra.yaml to + something besides the resource name of the cluster, set the value to use on this property. + :vartype cluster_name_override: str + :ivar authentication_method: Which authentication method Cassandra should use to authenticate + clients. 'None' turns off authentication, so should not be used except in emergencies. + 'Cassandra' is the default password based authentication. The default is 'Cassandra'. Known + values are: "None", "Cassandra". + :vartype authentication_method: str or ~azure.mgmt.cosmosdb.models.AuthenticationMethod + :ivar initial_cassandra_admin_password: Initial password for clients connecting as admin to the + cluster. Should be changed after cluster creation. Returns null on GET. This field only applies + when the authenticationMethod field is 'Cassandra'. + :vartype initial_cassandra_admin_password: str + :ivar prometheus_endpoint: Hostname or IP address where the Prometheus endpoint containing data + about the managed Cassandra nodes can be reached. + :vartype prometheus_endpoint: ~azure.mgmt.cosmosdb.models.SeedNode + :ivar repair_enabled: Should automatic repairs run on this cluster? If omitted, this is true, + and should stay true unless you are running a hybrid cluster where you are already doing your + own repairs. + :vartype repair_enabled: bool + :ivar client_certificates: List of TLS certificates used to authorize clients connecting to the + cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if + clientCertificates is set, the managed Cassandra cluster will reject all connections not + bearing a TLS client certificate that can be validated from one or more of the public + certificates in this property. + :vartype client_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] + :ivar external_gossip_certificates: List of TLS certificates used to authorize gossip from + unmanaged data centers. The TLS certificates of all nodes in unmanaged data centers must be + verifiable using one of the certificates provided in this property. + :vartype external_gossip_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] + :ivar gossip_certificates: List of TLS certificates that unmanaged nodes must trust for gossip + with managed nodes. All managed nodes will present TLS client certificates that are verifiable + using one of the certificates provided in this property. + :vartype gossip_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] + :ivar external_seed_nodes: List of IP addresses of seed nodes in unmanaged data centers. These + will be added to the seed node lists of all managed nodes. + :vartype external_seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] + :ivar seed_nodes: List of IP addresses of seed nodes in the managed data centers. These should + be added to the seed node lists of all unmanaged nodes. + :vartype seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] + :ivar hours_between_backups: Number of hours to wait between taking a backup of the cluster. To + disable backups, set this property to 0. + :vartype hours_between_backups: int + :ivar deallocated: Whether the cluster and associated data centers has been deallocated. + :vartype deallocated: bool + :ivar cassandra_audit_logging_enabled: Whether Cassandra audit logging is enabled. + :vartype cassandra_audit_logging_enabled: bool """ _validation = { - 'id': {'required': True}, - 'view_definition': {'required': True}, + 'gossip_certificates': {'readonly': True}, + 'seed_nodes': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'view_definition': {'key': 'viewDefinition', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'restore_from_backup_id': {'key': 'restoreFromBackupId', 'type': 'str'}, + 'delegated_management_subnet_id': {'key': 'delegatedManagementSubnetId', 'type': 'str'}, + 'cassandra_version': {'key': 'cassandraVersion', 'type': 'str'}, + 'cluster_name_override': {'key': 'clusterNameOverride', 'type': 'str'}, + 'authentication_method': {'key': 'authenticationMethod', 'type': 'str'}, + 'initial_cassandra_admin_password': {'key': 'initialCassandraAdminPassword', 'type': 'str'}, + 'prometheus_endpoint': {'key': 'prometheusEndpoint', 'type': 'SeedNode'}, + 'repair_enabled': {'key': 'repairEnabled', 'type': 'bool'}, + 'client_certificates': {'key': 'clientCertificates', 'type': '[Certificate]'}, + 'external_gossip_certificates': {'key': 'externalGossipCertificates', 'type': '[Certificate]'}, + 'gossip_certificates': {'key': 'gossipCertificates', 'type': '[Certificate]'}, + 'external_seed_nodes': {'key': 'externalSeedNodes', 'type': '[SeedNode]'}, + 'seed_nodes': {'key': 'seedNodes', 'type': '[SeedNode]'}, + 'hours_between_backups': {'key': 'hoursBetweenBackups', 'type': 'int'}, + 'deallocated': {'key': 'deallocated', 'type': 'bool'}, + 'cassandra_audit_logging_enabled': {'key': 'cassandraAuditLoggingEnabled', 'type': 'bool'}, } def __init__( self, *, - id: str, - view_definition: str, + provisioning_state: Optional[Union[str, "_models.ManagedCassandraProvisioningState"]] = None, + restore_from_backup_id: Optional[str] = None, + delegated_management_subnet_id: Optional[str] = None, + cassandra_version: Optional[str] = None, + cluster_name_override: Optional[str] = None, + authentication_method: Optional[Union[str, "_models.AuthenticationMethod"]] = None, + initial_cassandra_admin_password: Optional[str] = None, + prometheus_endpoint: Optional["_models.SeedNode"] = None, + repair_enabled: Optional[bool] = None, + client_certificates: Optional[List["_models.Certificate"]] = None, + external_gossip_certificates: Optional[List["_models.Certificate"]] = None, + external_seed_nodes: Optional[List["_models.SeedNode"]] = None, + hours_between_backups: Optional[int] = None, + deallocated: Optional[bool] = None, + cassandra_audit_logging_enabled: Optional[bool] = None, **kwargs ): """ - :keyword id: Required. Name of the Cosmos DB Cassandra view. - :paramtype id: str - :keyword view_definition: Required. View Definition of the Cosmos DB Cassandra view. - :paramtype view_definition: str + :keyword provisioning_state: The status of the resource at the time the operation was called. + Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :paramtype provisioning_state: str or + ~azure.mgmt.cosmosdb.models.ManagedCassandraProvisioningState + :keyword restore_from_backup_id: To create an empty cluster, omit this field or set it to null. + To restore a backup into a new cluster, set this field to the resource id of the backup. + :paramtype restore_from_backup_id: str + :keyword delegated_management_subnet_id: Resource id of a subnet that this cluster's management + service should have its network interface attached to. The subnet must be routable to all + subnets that will be delegated to data centers. The resource id must be of the form + '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/virtualNetworks/:code:``/subnets/:code:``'. + :paramtype delegated_management_subnet_id: str + :keyword cassandra_version: Which version of Cassandra should this cluster converge to running + (e.g., 3.11). When updated, the cluster may take some time to migrate to the new version. + :paramtype cassandra_version: str + :keyword cluster_name_override: If you need to set the clusterName property in cassandra.yaml + to something besides the resource name of the cluster, set the value to use on this property. + :paramtype cluster_name_override: str + :keyword authentication_method: Which authentication method Cassandra should use to + authenticate clients. 'None' turns off authentication, so should not be used except in + emergencies. 'Cassandra' is the default password based authentication. The default is + 'Cassandra'. Known values are: "None", "Cassandra". + :paramtype authentication_method: str or ~azure.mgmt.cosmosdb.models.AuthenticationMethod + :keyword initial_cassandra_admin_password: Initial password for clients connecting as admin to + the cluster. Should be changed after cluster creation. Returns null on GET. This field only + applies when the authenticationMethod field is 'Cassandra'. + :paramtype initial_cassandra_admin_password: str + :keyword prometheus_endpoint: Hostname or IP address where the Prometheus endpoint containing + data about the managed Cassandra nodes can be reached. + :paramtype prometheus_endpoint: ~azure.mgmt.cosmosdb.models.SeedNode + :keyword repair_enabled: Should automatic repairs run on this cluster? If omitted, this is + true, and should stay true unless you are running a hybrid cluster where you are already doing + your own repairs. + :paramtype repair_enabled: bool + :keyword client_certificates: List of TLS certificates used to authorize clients connecting to + the cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if + clientCertificates is set, the managed Cassandra cluster will reject all connections not + bearing a TLS client certificate that can be validated from one or more of the public + certificates in this property. + :paramtype client_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] + :keyword external_gossip_certificates: List of TLS certificates used to authorize gossip from + unmanaged data centers. The TLS certificates of all nodes in unmanaged data centers must be + verifiable using one of the certificates provided in this property. + :paramtype external_gossip_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] + :keyword external_seed_nodes: List of IP addresses of seed nodes in unmanaged data centers. + These will be added to the seed node lists of all managed nodes. + :paramtype external_seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] + :keyword hours_between_backups: Number of hours to wait between taking a backup of the cluster. + To disable backups, set this property to 0. + :paramtype hours_between_backups: int + :keyword deallocated: Whether the cluster and associated data centers has been deallocated. + :paramtype deallocated: bool + :keyword cassandra_audit_logging_enabled: Whether Cassandra audit logging is enabled. + :paramtype cassandra_audit_logging_enabled: bool """ - super(CassandraViewResource, self).__init__(**kwargs) - self.id = id - self.view_definition = view_definition - - -class CassandraViewGetPropertiesResource(ExtendedResourceProperties, CassandraViewResource): - """CassandraViewGetPropertiesResource. + super(ClusterResourceProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + self.restore_from_backup_id = restore_from_backup_id + self.delegated_management_subnet_id = delegated_management_subnet_id + self.cassandra_version = cassandra_version + self.cluster_name_override = cluster_name_override + self.authentication_method = authentication_method + self.initial_cassandra_admin_password = initial_cassandra_admin_password + self.prometheus_endpoint = prometheus_endpoint + self.repair_enabled = repair_enabled + self.client_certificates = client_certificates + self.external_gossip_certificates = external_gossip_certificates + self.gossip_certificates = None + self.external_seed_nodes = external_seed_nodes + self.seed_nodes = None + self.hours_between_backups = hours_between_backups + self.deallocated = deallocated + self.cassandra_audit_logging_enabled = cassandra_audit_logging_enabled - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class Column(msrest.serialization.Model): + """Cosmos DB Cassandra table column. - :ivar id: Required. Name of the Cosmos DB Cassandra view. - :vartype id: str - :ivar view_definition: Required. View Definition of the Cosmos DB Cassandra view. - :vartype view_definition: str - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str + :ivar name: Name of the Cosmos DB Cassandra table column. + :vartype name: str + :ivar type: Type of the Cosmos DB Cassandra table column. + :vartype type: str """ - _validation = { - 'id': {'required': True}, - 'view_definition': {'required': True}, - 'rid': {'readonly': True}, - 'ts': {'readonly': True}, - 'etag': {'readonly': True}, + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the Cosmos DB Cassandra table column. + :paramtype name: str + :keyword type: Type of the Cosmos DB Cassandra table column. + :paramtype type: str + """ + super(Column, self).__init__(**kwargs) + self.name = name + self.type = type + + +class CommandOutput(msrest.serialization.Model): + """Response of /command api. + + :ivar command_output: Output of the command. + :vartype command_output: str + """ + _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'view_definition': {'key': 'viewDefinition', 'type': 'str'}, - 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'float'}, - 'etag': {'key': '_etag', 'type': 'str'}, + 'command_output': {'key': 'commandOutput', 'type': 'str'}, } def __init__( self, *, - id: str, - view_definition: str, + command_output: Optional[str] = None, **kwargs ): """ - :keyword id: Required. Name of the Cosmos DB Cassandra view. - :paramtype id: str - :keyword view_definition: Required. View Definition of the Cosmos DB Cassandra view. - :paramtype view_definition: str + :keyword command_output: Output of the command. + :paramtype command_output: str """ - super(CassandraViewGetPropertiesResource, self).__init__(id=id, view_definition=view_definition, **kwargs) - self.id = id - self.view_definition = view_definition - self.rid = None - self.ts = None - self.etag = None + super(CommandOutput, self).__init__(**kwargs) + self.command_output = command_output -class CassandraViewGetResults(ARMResourceProperties): - """An Azure Cosmos DB Cassandra view. +class CommandPostBody(msrest.serialization.Model): + """Specification of which command to run where. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesOptions + :ivar command: Required. The command which should be run. + :vartype command: str + :ivar arguments: The arguments for the command to be run. + :vartype arguments: dict[str, str] + :ivar host: Required. IP address of the cassandra host to run the command on. + :vartype host: str + :ivar cassandra_stop_start: If true, stops cassandra before executing the command and then + start it again. + :vartype cassandra_stop_start: bool + :ivar readwrite: If true, allows the command to *write* to the cassandra directory, otherwise + read-only. + :vartype readwrite: bool """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'command': {'required': True}, + 'host': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'CassandraViewGetPropertiesResource'}, - 'options': {'key': 'properties.options', 'type': 'CassandraViewGetPropertiesOptions'}, + 'command': {'key': 'command', 'type': 'str'}, + 'arguments': {'key': 'arguments', 'type': '{str}'}, + 'host': {'key': 'host', 'type': 'str'}, + 'cassandra_stop_start': {'key': 'cassandra-stop-start', 'type': 'bool'}, + 'readwrite': {'key': 'readwrite', 'type': 'bool'}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["CassandraViewGetPropertiesResource"] = None, - options: Optional["CassandraViewGetPropertiesOptions"] = None, + command: str, + host: str, + arguments: Optional[Dict[str, str]] = None, + cassandra_stop_start: Optional[bool] = None, + readwrite: Optional[bool] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesOptions + :keyword command: Required. The command which should be run. + :paramtype command: str + :keyword arguments: The arguments for the command to be run. + :paramtype arguments: dict[str, str] + :keyword host: Required. IP address of the cassandra host to run the command on. + :paramtype host: str + :keyword cassandra_stop_start: If true, stops cassandra before executing the command and then + start it again. + :paramtype cassandra_stop_start: bool + :keyword readwrite: If true, allows the command to *write* to the cassandra directory, + otherwise read-only. + :paramtype readwrite: bool """ - super(CassandraViewGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options + super(CommandPostBody, self).__init__(**kwargs) + self.command = command + self.arguments = arguments + self.host = host + self.cassandra_stop_start = cassandra_stop_start + self.readwrite = readwrite -class CassandraViewListResult(msrest.serialization.Model): - """The List operation response, that contains the Cassandra views and their properties. +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Cassandra views and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :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 = { - 'value': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CassandraViewGetResults]'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, } def __init__( @@ -1844,471 +1825,629 @@ def __init__( ): """ """ - super(CassandraViewListResult, self).__init__(**kwargs) - self.value = None + super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None -class Certificate(msrest.serialization.Model): - """Certificate. +class ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems(msrest.serialization.Model): + """ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems. - :ivar pem: PEM formatted public key. - :vartype pem: str + :ivar address: The node's IP address. + :vartype address: str + :ivar state: The state of the node in Cassandra ring. Known values are: "Normal", "Leaving", + "Joining", "Moving", "Stopped". + :vartype state: str or ~azure.mgmt.cosmosdb.models.NodeState + :ivar status: + :vartype status: str + :ivar load: The amount of file system data in the data directory (e.g., 47.66 kB), excluding + all content in the snapshots subdirectories. Because all SSTable data files are included, any + data that is not cleaned up (such as TTL-expired cells or tombstones) is counted. + :vartype load: str + :ivar tokens: List of tokens this node covers. + :vartype tokens: list[str] + :ivar size: + :vartype size: int + :ivar host_id: The network ID of the node. + :vartype host_id: str + :ivar rack: The rack this node is part of. + :vartype rack: str + :ivar timestamp: The timestamp when these statistics were captured. + :vartype timestamp: str + :ivar disk_used_kb: The amount of disk used, in kB, of the directory /var/lib/cassandra. + :vartype disk_used_kb: long + :ivar disk_free_kb: The amount of disk free, in kB, of the directory /var/lib/cassandra. + :vartype disk_free_kb: long + :ivar memory_used_kb: Used memory (calculated as total - free - buffers - cache), in kB. + :vartype memory_used_kb: long + :ivar memory_buffers_and_cached_kb: Memory used by kernel buffers (Buffers in /proc/meminfo) + and page cache and slabs (Cached and SReclaimable in /proc/meminfo), in kB. + :vartype memory_buffers_and_cached_kb: long + :ivar memory_free_kb: Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. + :vartype memory_free_kb: long + :ivar memory_total_kb: Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. + :vartype memory_total_kb: long + :ivar cpu_usage: A float representing the current system-wide CPU utilization as a percentage. + :vartype cpu_usage: float """ _attribute_map = { - 'pem': {'key': 'pem', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'load': {'key': 'load', 'type': 'str'}, + 'tokens': {'key': 'tokens', 'type': '[str]'}, + 'size': {'key': 'size', 'type': 'int'}, + 'host_id': {'key': 'hostID', 'type': 'str'}, + 'rack': {'key': 'rack', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'str'}, + 'disk_used_kb': {'key': 'diskUsedKB', 'type': 'long'}, + 'disk_free_kb': {'key': 'diskFreeKB', 'type': 'long'}, + 'memory_used_kb': {'key': 'memoryUsedKB', 'type': 'long'}, + 'memory_buffers_and_cached_kb': {'key': 'memoryBuffersAndCachedKB', 'type': 'long'}, + 'memory_free_kb': {'key': 'memoryFreeKB', 'type': 'long'}, + 'memory_total_kb': {'key': 'memoryTotalKB', 'type': 'long'}, + 'cpu_usage': {'key': 'cpuUsage', 'type': 'float'}, } def __init__( self, *, - pem: Optional[str] = None, + address: Optional[str] = None, + state: Optional[Union[str, "_models.NodeState"]] = None, + status: Optional[str] = None, + load: Optional[str] = None, + tokens: Optional[List[str]] = None, + size: Optional[int] = None, + host_id: Optional[str] = None, + rack: Optional[str] = None, + timestamp: Optional[str] = None, + disk_used_kb: Optional[int] = None, + disk_free_kb: Optional[int] = None, + memory_used_kb: Optional[int] = None, + memory_buffers_and_cached_kb: Optional[int] = None, + memory_free_kb: Optional[int] = None, + memory_total_kb: Optional[int] = None, + cpu_usage: Optional[float] = None, **kwargs ): """ - :keyword pem: PEM formatted public key. - :paramtype pem: str + :keyword address: The node's IP address. + :paramtype address: str + :keyword state: The state of the node in Cassandra ring. Known values are: "Normal", "Leaving", + "Joining", "Moving", "Stopped". + :paramtype state: str or ~azure.mgmt.cosmosdb.models.NodeState + :keyword status: + :paramtype status: str + :keyword load: The amount of file system data in the data directory (e.g., 47.66 kB), excluding + all content in the snapshots subdirectories. Because all SSTable data files are included, any + data that is not cleaned up (such as TTL-expired cells or tombstones) is counted. + :paramtype load: str + :keyword tokens: List of tokens this node covers. + :paramtype tokens: list[str] + :keyword size: + :paramtype size: int + :keyword host_id: The network ID of the node. + :paramtype host_id: str + :keyword rack: The rack this node is part of. + :paramtype rack: str + :keyword timestamp: The timestamp when these statistics were captured. + :paramtype timestamp: str + :keyword disk_used_kb: The amount of disk used, in kB, of the directory /var/lib/cassandra. + :paramtype disk_used_kb: long + :keyword disk_free_kb: The amount of disk free, in kB, of the directory /var/lib/cassandra. + :paramtype disk_free_kb: long + :keyword memory_used_kb: Used memory (calculated as total - free - buffers - cache), in kB. + :paramtype memory_used_kb: long + :keyword memory_buffers_and_cached_kb: Memory used by kernel buffers (Buffers in /proc/meminfo) + and page cache and slabs (Cached and SReclaimable in /proc/meminfo), in kB. + :paramtype memory_buffers_and_cached_kb: long + :keyword memory_free_kb: Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. + :paramtype memory_free_kb: long + :keyword memory_total_kb: Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in + kB. + :paramtype memory_total_kb: long + :keyword cpu_usage: A float representing the current system-wide CPU utilization as a + percentage. + :paramtype cpu_usage: float """ - super(Certificate, self).__init__(**kwargs) - self.pem = pem - + super(ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems, self).__init__(**kwargs) + self.address = address + self.state = state + self.status = status + self.load = load + self.tokens = tokens + self.size = size + self.host_id = host_id + self.rack = rack + self.timestamp = timestamp + self.disk_used_kb = disk_used_kb + self.disk_free_kb = disk_free_kb + self.memory_used_kb = memory_used_kb + self.memory_buffers_and_cached_kb = memory_buffers_and_cached_kb + self.memory_free_kb = memory_free_kb + self.memory_total_kb = memory_total_kb + self.cpu_usage = cpu_usage -class ClientEncryptionIncludedPath(msrest.serialization.Model): - """. - All required parameters must be populated in order to send to Azure. +class CompositePath(msrest.serialization.Model): + """CompositePath. - :ivar path: Required. Path that needs to be encrypted. + :ivar path: The path for which the indexing behavior applies to. Index paths typically start + with root and end with wildcard (/path/*). :vartype path: str - :ivar client_encryption_key_id: Required. The identifier of the Client Encryption Key to be - used to encrypt the path. - :vartype client_encryption_key_id: str - :ivar encryption_type: Required. The type of encryption to be performed. Eg - Deterministic, - Randomized. - :vartype encryption_type: str - :ivar encryption_algorithm: Required. The encryption algorithm which will be used. Eg - - AEAD_AES_256_CBC_HMAC_SHA256. - :vartype encryption_algorithm: str + :ivar order: Sort order for composite paths. Known values are: "ascending", "descending". + :vartype order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder """ - _validation = { - 'path': {'required': True}, - 'client_encryption_key_id': {'required': True}, - 'encryption_type': {'required': True}, - 'encryption_algorithm': {'required': True}, - } - _attribute_map = { 'path': {'key': 'path', 'type': 'str'}, - 'client_encryption_key_id': {'key': 'clientEncryptionKeyId', 'type': 'str'}, - 'encryption_type': {'key': 'encryptionType', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, + 'order': {'key': 'order', 'type': 'str'}, } def __init__( self, *, - path: str, - client_encryption_key_id: str, - encryption_type: str, - encryption_algorithm: str, + path: Optional[str] = None, + order: Optional[Union[str, "_models.CompositePathSortOrder"]] = None, **kwargs ): """ - :keyword path: Required. Path that needs to be encrypted. + :keyword path: The path for which the indexing behavior applies to. Index paths typically start + with root and end with wildcard (/path/*). :paramtype path: str - :keyword client_encryption_key_id: Required. The identifier of the Client Encryption Key to be - used to encrypt the path. - :paramtype client_encryption_key_id: str - :keyword encryption_type: Required. The type of encryption to be performed. Eg - Deterministic, - Randomized. - :paramtype encryption_type: str - :keyword encryption_algorithm: Required. The encryption algorithm which will be used. Eg - - AEAD_AES_256_CBC_HMAC_SHA256. - :paramtype encryption_algorithm: str - """ - super(ClientEncryptionIncludedPath, self).__init__(**kwargs) + :keyword order: Sort order for composite paths. Known values are: "ascending", "descending". + :paramtype order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder + """ + super(CompositePath, self).__init__(**kwargs) self.path = path - self.client_encryption_key_id = client_encryption_key_id - self.encryption_type = encryption_type - self.encryption_algorithm = encryption_algorithm - - -class ClientEncryptionKeyCreateUpdateParameters(msrest.serialization.Model): - """Parameters to create and update ClientEncryptionKey. + self.order = order - All required parameters must be populated in order to send to Azure. - :ivar resource: Required. The standard JSON format of a ClientEncryptionKey. - :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource - """ +class ConflictResolutionPolicy(msrest.serialization.Model): + """The conflict resolution policy for the container. - _validation = { - 'resource': {'required': True}, - } + :ivar mode: Indicates the conflict resolution mode. Known values are: "LastWriterWins", + "Custom". Default value: "LastWriterWins". + :vartype mode: str or ~azure.mgmt.cosmosdb.models.ConflictResolutionMode + :ivar conflict_resolution_path: The conflict resolution path in the case of LastWriterWins + mode. + :vartype conflict_resolution_path: str + :ivar conflict_resolution_procedure: The procedure to resolve conflicts in the case of custom + mode. + :vartype conflict_resolution_procedure: str + """ _attribute_map = { - 'resource': {'key': 'properties.resource', 'type': 'ClientEncryptionKeyResource'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, + 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, } def __init__( self, *, - resource: "ClientEncryptionKeyResource", + mode: Optional[Union[str, "_models.ConflictResolutionMode"]] = "LastWriterWins", + conflict_resolution_path: Optional[str] = None, + conflict_resolution_procedure: Optional[str] = None, **kwargs ): """ - :keyword resource: Required. The standard JSON format of a ClientEncryptionKey. - :paramtype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource + :keyword mode: Indicates the conflict resolution mode. Known values are: "LastWriterWins", + "Custom". Default value: "LastWriterWins". + :paramtype mode: str or ~azure.mgmt.cosmosdb.models.ConflictResolutionMode + :keyword conflict_resolution_path: The conflict resolution path in the case of LastWriterWins + mode. + :paramtype conflict_resolution_path: str + :keyword conflict_resolution_procedure: The procedure to resolve conflicts in the case of + custom mode. + :paramtype conflict_resolution_procedure: str """ - super(ClientEncryptionKeyCreateUpdateParameters, self).__init__(**kwargs) - self.resource = resource + super(ConflictResolutionPolicy, self).__init__(**kwargs) + self.mode = mode + self.conflict_resolution_path = conflict_resolution_path + self.conflict_resolution_procedure = conflict_resolution_procedure -class ClientEncryptionKeyResource(msrest.serialization.Model): - """Cosmos DB client encryption key resource object. +class ConnectionError(msrest.serialization.Model): + """ConnectionError. - :ivar id: Name of the ClientEncryptionKey. - :vartype id: str - :ivar encryption_algorithm: Encryption algorithm that will be used along with this client - encryption key to encrypt/decrypt data. - :vartype encryption_algorithm: str - :ivar wrapped_data_encryption_key: Wrapped (encrypted) form of the key represented as a byte - array. - :vartype wrapped_data_encryption_key: bytearray - :ivar key_wrap_metadata: Metadata for the wrapping provider that can be used to unwrap the - wrapped client encryption key. - :vartype key_wrap_metadata: ~azure.mgmt.cosmosdb.models.KeyWrapMetadata + :ivar connection_state: The kind of connection error that occurred. Known values are: + "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", + "InternalOperatorToDataCenterCertificateError", "InternalError". + :vartype connection_state: str or ~azure.mgmt.cosmosdb.models.ConnectionState + :ivar i_p_from: The IP of host that originated the failed connection. + :vartype i_p_from: str + :ivar i_p_to: The IP that the connection attempted to reach. + :vartype i_p_to: str + :ivar port: The TCP port the connection was attempted on. + :vartype port: int + :ivar exception: Detailed error message about the failed connection. + :vartype exception: str """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - 'wrapped_data_encryption_key': {'key': 'wrappedDataEncryptionKey', 'type': 'bytearray'}, - 'key_wrap_metadata': {'key': 'keyWrapMetadata', 'type': 'KeyWrapMetadata'}, + 'connection_state': {'key': 'connectionState', 'type': 'str'}, + 'i_p_from': {'key': 'iPFrom', 'type': 'str'}, + 'i_p_to': {'key': 'iPTo', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'exception': {'key': 'exception', 'type': 'str'}, } def __init__( self, *, - id: Optional[str] = None, - encryption_algorithm: Optional[str] = None, - wrapped_data_encryption_key: Optional[bytearray] = None, - key_wrap_metadata: Optional["KeyWrapMetadata"] = None, + connection_state: Optional[Union[str, "_models.ConnectionState"]] = None, + i_p_from: Optional[str] = None, + i_p_to: Optional[str] = None, + port: Optional[int] = None, + exception: Optional[str] = None, **kwargs ): """ - :keyword id: Name of the ClientEncryptionKey. - :paramtype id: str - :keyword encryption_algorithm: Encryption algorithm that will be used along with this client - encryption key to encrypt/decrypt data. - :paramtype encryption_algorithm: str - :keyword wrapped_data_encryption_key: Wrapped (encrypted) form of the key represented as a byte - array. - :paramtype wrapped_data_encryption_key: bytearray - :keyword key_wrap_metadata: Metadata for the wrapping provider that can be used to unwrap the - wrapped client encryption key. - :paramtype key_wrap_metadata: ~azure.mgmt.cosmosdb.models.KeyWrapMetadata - """ - super(ClientEncryptionKeyResource, self).__init__(**kwargs) - self.id = id - self.encryption_algorithm = encryption_algorithm - self.wrapped_data_encryption_key = wrapped_data_encryption_key - self.key_wrap_metadata = key_wrap_metadata + :keyword connection_state: The kind of connection error that occurred. Known values are: + "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", + "InternalOperatorToDataCenterCertificateError", "InternalError". + :paramtype connection_state: str or ~azure.mgmt.cosmosdb.models.ConnectionState + :keyword i_p_from: The IP of host that originated the failed connection. + :paramtype i_p_from: str + :keyword i_p_to: The IP that the connection attempted to reach. + :paramtype i_p_to: str + :keyword port: The TCP port the connection was attempted on. + :paramtype port: int + :keyword exception: Detailed error message about the failed connection. + :paramtype exception: str + """ + super(ConnectionError, self).__init__(**kwargs) + self.connection_state = connection_state + self.i_p_from = i_p_from + self.i_p_to = i_p_to + self.port = port + self.exception = exception -class ClientEncryptionKeyGetPropertiesResource(ExtendedResourceProperties, ClientEncryptionKeyResource): - """ClientEncryptionKeyGetPropertiesResource. +class ConsistencyPolicy(msrest.serialization.Model): + """The consistency policy for the Cosmos DB database account. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: Name of the ClientEncryptionKey. - :vartype id: str - :ivar encryption_algorithm: Encryption algorithm that will be used along with this client - encryption key to encrypt/decrypt data. - :vartype encryption_algorithm: str - :ivar wrapped_data_encryption_key: Wrapped (encrypted) form of the key represented as a byte - array. - :vartype wrapped_data_encryption_key: bytearray - :ivar key_wrap_metadata: Metadata for the wrapping provider that can be used to unwrap the - wrapped client encryption key. - :vartype key_wrap_metadata: ~azure.mgmt.cosmosdb.models.KeyWrapMetadata - :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: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str + :ivar default_consistency_level: Required. The default consistency level and configuration + settings of the Cosmos DB account. Known values are: "Eventual", "Session", "BoundedStaleness", + "Strong", "ConsistentPrefix". + :vartype default_consistency_level: str or ~azure.mgmt.cosmosdb.models.DefaultConsistencyLevel + :ivar max_staleness_prefix: When used with the Bounded Staleness consistency level, this value + represents the number of stale requests tolerated. Accepted range for this value is 1 – + 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :vartype max_staleness_prefix: long + :ivar max_interval_in_seconds: When used with the Bounded Staleness consistency level, this + value represents the time amount of staleness (in seconds) tolerated. Accepted range for this + value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :vartype max_interval_in_seconds: int """ _validation = { - 'rid': {'readonly': True}, - 'ts': {'readonly': True}, - 'etag': {'readonly': True}, + 'default_consistency_level': {'required': True}, + 'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1}, + 'max_interval_in_seconds': {'maximum': 86400, 'minimum': 5}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - 'wrapped_data_encryption_key': {'key': 'wrappedDataEncryptionKey', 'type': 'bytearray'}, - 'key_wrap_metadata': {'key': 'keyWrapMetadata', 'type': 'KeyWrapMetadata'}, - 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'float'}, - 'etag': {'key': '_etag', 'type': 'str'}, + 'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'str'}, + 'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'}, + 'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'}, } def __init__( self, *, - id: Optional[str] = None, - encryption_algorithm: Optional[str] = None, - wrapped_data_encryption_key: Optional[bytearray] = None, - key_wrap_metadata: Optional["KeyWrapMetadata"] = None, + default_consistency_level: Union[str, "_models.DefaultConsistencyLevel"], + max_staleness_prefix: Optional[int] = None, + max_interval_in_seconds: Optional[int] = None, **kwargs ): """ - :keyword id: Name of the ClientEncryptionKey. - :paramtype id: str - :keyword encryption_algorithm: Encryption algorithm that will be used along with this client - encryption key to encrypt/decrypt data. - :paramtype encryption_algorithm: str - :keyword wrapped_data_encryption_key: Wrapped (encrypted) form of the key represented as a byte - array. - :paramtype wrapped_data_encryption_key: bytearray - :keyword key_wrap_metadata: Metadata for the wrapping provider that can be used to unwrap the - wrapped client encryption key. - :paramtype key_wrap_metadata: ~azure.mgmt.cosmosdb.models.KeyWrapMetadata - """ - super(ClientEncryptionKeyGetPropertiesResource, self).__init__(id=id, encryption_algorithm=encryption_algorithm, wrapped_data_encryption_key=wrapped_data_encryption_key, key_wrap_metadata=key_wrap_metadata, **kwargs) - self.id = id - self.encryption_algorithm = encryption_algorithm - self.wrapped_data_encryption_key = wrapped_data_encryption_key - self.key_wrap_metadata = key_wrap_metadata - self.rid = None - self.ts = None - self.etag = None + :keyword default_consistency_level: Required. The default consistency level and configuration + settings of the Cosmos DB account. Known values are: "Eventual", "Session", "BoundedStaleness", + "Strong", "ConsistentPrefix". + :paramtype default_consistency_level: str or + ~azure.mgmt.cosmosdb.models.DefaultConsistencyLevel + :keyword max_staleness_prefix: When used with the Bounded Staleness consistency level, this + value represents the number of stale requests tolerated. Accepted range for this value is 1 – + 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :paramtype max_staleness_prefix: long + :keyword max_interval_in_seconds: When used with the Bounded Staleness consistency level, this + value represents the time amount of staleness (in seconds) tolerated. Accepted range for this + value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :paramtype max_interval_in_seconds: int + """ + super(ConsistencyPolicy, self).__init__(**kwargs) + self.default_consistency_level = default_consistency_level + self.max_staleness_prefix = max_staleness_prefix + self.max_interval_in_seconds = max_interval_in_seconds -class ClientEncryptionKeyGetResults(ARMProxyResource): - """Client Encryption Key. +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. - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetPropertiesResource + :ivar paths: List of paths using which data within the container can be partitioned. + :vartype paths: list[str] + :ivar kind: Indicates the kind of algorithm used for partitioning. For MultiHash, multiple + partition keys (upto three maximum) are supported for container create. Known values are: + "Hash", "Range", "MultiHash". Default value: "Hash". + :vartype kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind + :ivar version: Indicates the version of the partition key definition. + :vartype version: int + :ivar system_key: Indicates if the container is using a system generated partition key. + :vartype system_key: bool """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'version': {'maximum': 2, 'minimum': 1}, + 'system_key': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'resource': {'key': 'properties.resource', 'type': 'ClientEncryptionKeyGetPropertiesResource'}, + 'paths': {'key': 'paths', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'int'}, + 'system_key': {'key': 'systemKey', 'type': 'bool'}, } def __init__( self, *, - resource: Optional["ClientEncryptionKeyGetPropertiesResource"] = None, + paths: Optional[List[str]] = None, + kind: Optional[Union[str, "_models.PartitionKind"]] = "Hash", + version: Optional[int] = None, **kwargs ): """ - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetPropertiesResource + :keyword paths: List of paths using which data within the container can be partitioned. + :paramtype paths: list[str] + :keyword kind: Indicates the kind of algorithm used for partitioning. For MultiHash, multiple + partition keys (upto three maximum) are supported for container create. Known values are: + "Hash", "Range", "MultiHash". Default value: "Hash". + :paramtype kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind + :keyword version: Indicates the version of the partition key definition. + :paramtype version: int """ - super(ClientEncryptionKeyGetResults, self).__init__(**kwargs) - self.resource = resource - + super(ContainerPartitionKey, self).__init__(**kwargs) + self.paths = paths + self.kind = kind + self.version = version + self.system_key = None -class ClientEncryptionKeysListResult(msrest.serialization.Model): - """The List operation response, that contains the client encryption keys and their properties. - Variables are only populated by the server, and will be ignored when sending a request. +class ContinuousBackupInformation(msrest.serialization.Model): + """Information about the status of continuous backups. - :ivar value: List of client encryption keys and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :ivar latest_restorable_timestamp: The latest restorable timestamp for a resource. + :vartype latest_restorable_timestamp: str """ - _validation = { - 'value': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[ClientEncryptionKeyGetResults]'}, + 'latest_restorable_timestamp': {'key': 'latestRestorableTimestamp', 'type': 'str'}, } def __init__( self, + *, + latest_restorable_timestamp: Optional[str] = None, **kwargs ): """ + :keyword latest_restorable_timestamp: The latest restorable timestamp for a resource. + :paramtype latest_restorable_timestamp: str """ - super(ClientEncryptionKeysListResult, self).__init__(**kwargs) - self.value = None - + super(ContinuousBackupInformation, self).__init__(**kwargs) + self.latest_restorable_timestamp = latest_restorable_timestamp -class ClientEncryptionPolicy(msrest.serialization.Model): - """Cosmos DB client encryption policy. - All required parameters must be populated in order to send to Azure. +class ContinuousBackupRestoreLocation(msrest.serialization.Model): + """Properties of the regional restorable account. - :ivar included_paths: Required. Paths of the item that need encryption along with path-specific - settings. - :vartype included_paths: list[~azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath] - :ivar policy_format_version: Version of the client encryption policy definition. Please note, - user passed value is ignored. Default policy version is 1. - :vartype policy_format_version: int + :ivar location: The name of the continuous backup restore location. + :vartype location: str """ - _validation = { - 'included_paths': {'required': True}, - } - _attribute_map = { - 'included_paths': {'key': 'includedPaths', 'type': '[ClientEncryptionIncludedPath]'}, - 'policy_format_version': {'key': 'policyFormatVersion', 'type': 'int'}, + 'location': {'key': 'location', 'type': 'str'}, } def __init__( self, *, - included_paths: List["ClientEncryptionIncludedPath"], - policy_format_version: Optional[int] = 1, + location: Optional[str] = None, **kwargs ): """ - :keyword included_paths: Required. Paths of the item that need encryption along with - path-specific settings. - :paramtype included_paths: list[~azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath] - :keyword policy_format_version: Version of the client encryption policy definition. Please - note, user passed value is ignored. Default policy version is 1. - :paramtype policy_format_version: int + :keyword location: The name of the continuous backup restore location. + :paramtype location: str """ - super(ClientEncryptionPolicy, self).__init__(**kwargs) - self.included_paths = included_paths - self.policy_format_version = policy_format_version + super(ContinuousBackupRestoreLocation, self).__init__(**kwargs) + self.location = location -class ClusterKey(msrest.serialization.Model): - """Cosmos DB Cassandra table cluster key. +class ContinuousModeBackupPolicy(BackupPolicy): + """The object representing continuous mode backup policy. - :ivar name: Name of the Cosmos DB Cassandra table cluster key. - :vartype name: str - :ivar order_by: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and - "Desc". - :vartype order_by: str + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Describes the mode of backups.Constant filled by server. Known values + are: "Periodic", "Continuous". + :vartype type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType + :ivar migration_state: The object representing the state of the migration between the backup + policies. + :vartype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'order_by': {'key': 'orderBy', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'migration_state': {'key': 'migrationState', 'type': 'BackupPolicyMigrationState'}, } def __init__( self, *, - name: Optional[str] = None, - order_by: Optional[str] = None, + migration_state: Optional["_models.BackupPolicyMigrationState"] = None, **kwargs ): """ - :keyword name: Name of the Cosmos DB Cassandra table cluster key. - :paramtype name: str - :keyword order_by: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and - "Desc". - :paramtype order_by: str + :keyword migration_state: The object representing the state of the migration between the backup + policies. + :paramtype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState """ - super(ClusterKey, self).__init__(**kwargs) - self.name = name - self.order_by = order_by + super(ContinuousModeBackupPolicy, self).__init__(migration_state=migration_state, **kwargs) + self.type = 'Continuous' # type: str -class ManagedCassandraARMResourceProperties(msrest.serialization.Model): - """The core properties of ARM resources. +class CorsPolicy(msrest.serialization.Model): + """The CORS policy for the Cosmos DB database account. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedCassandraManagedServiceIdentity + :ivar allowed_origins: Required. The origin domains that are permitted to make a request + against the service via CORS. + :vartype allowed_origins: str + :ivar allowed_methods: The methods (HTTP request verbs) that the origin domain may use for a + CORS request. + :vartype allowed_methods: str + :ivar allowed_headers: The request headers that the origin domain may specify on the CORS + request. + :vartype allowed_headers: str + :ivar exposed_headers: The response headers that may be sent in the response to the CORS + request and exposed by the browser to the request issuer. + :vartype exposed_headers: str + :ivar max_age_in_seconds: The maximum amount time that a browser should cache the preflight + OPTIONS request. + :vartype max_age_in_seconds: long """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'allowed_origins': {'required': True}, + 'max_age_in_seconds': {'maximum': 2147483647, 'minimum': 1}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedCassandraManagedServiceIdentity'}, + 'allowed_origins': {'key': 'allowedOrigins', 'type': 'str'}, + 'allowed_methods': {'key': 'allowedMethods', 'type': 'str'}, + 'allowed_headers': {'key': 'allowedHeaders', 'type': 'str'}, + 'exposed_headers': {'key': 'exposedHeaders', 'type': 'str'}, + 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'long'}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedCassandraManagedServiceIdentity"] = None, + allowed_origins: str, + allowed_methods: Optional[str] = None, + allowed_headers: Optional[str] = None, + exposed_headers: Optional[str] = None, + max_age_in_seconds: Optional[int] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedCassandraManagedServiceIdentity + :keyword allowed_origins: Required. The origin domains that are permitted to make a request + against the service via CORS. + :paramtype allowed_origins: str + :keyword allowed_methods: The methods (HTTP request verbs) that the origin domain may use for a + CORS request. + :paramtype allowed_methods: str + :keyword allowed_headers: The request headers that the origin domain may specify on the CORS + request. + :paramtype allowed_headers: str + :keyword exposed_headers: The response headers that may be sent in the response to the CORS + request and exposed by the browser to the request issuer. + :paramtype exposed_headers: str + :keyword max_age_in_seconds: The maximum amount time that a browser should cache the preflight + OPTIONS request. + :paramtype max_age_in_seconds: long """ - super(ManagedCassandraARMResourceProperties, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.identity = identity + super(CorsPolicy, self).__init__(**kwargs) + self.allowed_origins = allowed_origins + self.allowed_methods = allowed_methods + self.allowed_headers = allowed_headers + self.exposed_headers = exposed_headers + self.max_age_in_seconds = max_age_in_seconds -class ClusterResource(ManagedCassandraARMResourceProperties): - """Representation of a managed Cassandra cluster. +class CreateUpdateOptions(msrest.serialization.Model): + """CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput". + + :ivar throughput: Request Units per second. For example, "throughput": 10000. + :vartype throughput: int + :ivar autoscale_settings: Specifies the Autoscale settings. + :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + """ + + _attribute_map = { + 'throughput': {'key': 'throughput', 'type': 'int'}, + 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, + } + + def __init__( + self, + *, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, + **kwargs + ): + """ + :keyword throughput: Request Units per second. For example, "throughput": 10000. + :paramtype throughput: int + :keyword autoscale_settings: Specifies the Autoscale settings. + :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + """ + super(CreateUpdateOptions, self).__init__(**kwargs) + self.throughput = throughput + self.autoscale_settings = autoscale_settings + + +class DatabaseAccountConnectionString(msrest.serialization.Model): + """Connection string for the Cosmos DB account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar connection_string: Value of the connection string. + :vartype connection_string: str + :ivar description: Description of the connection string. + :vartype description: str + """ + + _validation = { + 'connection_string': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DatabaseAccountConnectionString, self).__init__(**kwargs) + self.connection_string = None + self.description = None + + +class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB database accounts. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str :ivar name: The name of the ARM resource. @@ -2324,16 +2463,91 @@ class ClusterResource(ManagedCassandraARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] + :ivar kind: Indicates the type of database account. This can only be set at database account + creation. Known values are: "GlobalDocumentDB", "MongoDB", "Parse". + :vartype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedCassandraManagedServiceIdentity - :ivar properties: Properties of a managed Cassandra cluster. - :vartype properties: ~azure.mgmt.cosmosdb.models.ClusterResourceProperties + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :ivar consistency_policy: The consistency policy for the Cosmos DB account. + :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :ivar locations: Required. An array that contains the georeplication locations enabled for the + Cosmos DB account. + :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar database_account_offer_type: The offer type for the database. Has constant value: + "Standard". + :vartype database_account_offer_type: str + :ivar ip_rules: List of IpRules. + :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] + :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual + Network ACL rules. + :vartype is_virtual_network_filter_enabled: bool + :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare + event that the region is unavailable due to an outage. Automatic failover will result in a new + write region for the account and is chosen based on the failover priorities configured for the + account. + :vartype enable_automatic_failover: bool + :ivar capabilities: List of Cosmos DB capabilities for the account. + :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + account. + :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] + :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. + :vartype enable_multiple_write_locations: bool + :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. + :vartype enable_cassandra_connector: bool + :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* + account. Known values are: "Small". + :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer + :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources + (databases, containers, throughput) via account keys. + :vartype disable_key_based_metadata_write_access: bool + :ivar key_vault_key_uri: The URI of the key vault. + :vartype key_vault_key_uri: str + :ivar default_identity: The default identity for accessing key vault used in features like + customer managed keys. The default identity needs to be explicitly set by the users. It can be + "FirstPartyIdentity", "SystemAssignedIdentity" and more. + :vartype default_identity: str + :ivar public_network_access: Whether requests from Public Network are allowed. Known values + are: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess + :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. + :vartype enable_free_tier: bool + :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. + :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties + :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. + :vartype enable_analytical_storage: bool + :ivar analytical_storage_configuration: Analytical storage specific properties. + :vartype analytical_storage_configuration: + ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration + :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default", + "Restore". Default value: "Default". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar backup_policy: The object representing the policy for taking backups on an account. + :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy + :ivar cors: The CORS policy for the Cosmos DB database account. + :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known + values are: "None", "AzureServices". + :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :vartype network_acl_bypass_resource_ids: list[str] + :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :vartype disable_local_auth: bool + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters + :ivar capacity: The object that represents all properties related to capacity enforcement on an + account. + :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, } _attribute_map = { @@ -2342,3768 +2556,72 @@ class ClusterResource(ManagedCassandraARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedCassandraManagedServiceIdentity'}, - 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedCassandraManagedServiceIdentity"] = None, - properties: Optional["ClusterResourceProperties"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedCassandraManagedServiceIdentity - :keyword properties: Properties of a managed Cassandra cluster. - :paramtype properties: ~azure.mgmt.cosmosdb.models.ClusterResourceProperties - """ - super(ClusterResource, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.properties = properties - - -class ClusterResourceProperties(msrest.serialization.Model): - """Properties of a managed Cassandra cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: The status of the resource at the time the operation was called. - Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.cosmosdb.models.ManagedCassandraProvisioningState - :ivar restore_from_backup_id: To create an empty cluster, omit this field or set it to null. To - restore a backup into a new cluster, set this field to the resource id of the backup. - :vartype restore_from_backup_id: str - :ivar delegated_management_subnet_id: Resource id of a subnet that this cluster's management - service should have its network interface attached to. The subnet must be routable to all - subnets that will be delegated to data centers. The resource id must be of the form - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/virtualNetworks/:code:``/subnets/:code:``'. - :vartype delegated_management_subnet_id: str - :ivar cassandra_version: Which version of Cassandra should this cluster converge to running - (e.g., 3.11). When updated, the cluster may take some time to migrate to the new version. - :vartype cassandra_version: str - :ivar cluster_name_override: If you need to set the clusterName property in cassandra.yaml to - something besides the resource name of the cluster, set the value to use on this property. - :vartype cluster_name_override: str - :ivar authentication_method: Which authentication method Cassandra should use to authenticate - clients. 'None' turns off authentication, so should not be used except in emergencies. - 'Cassandra' is the default password based authentication. The default is 'Cassandra'. 'Ldap' is - in preview. Possible values include: "None", "Cassandra", "Ldap". - :vartype authentication_method: str or ~azure.mgmt.cosmosdb.models.AuthenticationMethod - :ivar initial_cassandra_admin_password: Initial password for clients connecting as admin to the - cluster. Should be changed after cluster creation. Returns null on GET. This field only applies - when the authenticationMethod field is 'Cassandra'. - :vartype initial_cassandra_admin_password: str - :ivar prometheus_endpoint: Hostname or IP address where the Prometheus endpoint containing data - about the managed Cassandra nodes can be reached. - :vartype prometheus_endpoint: ~azure.mgmt.cosmosdb.models.SeedNode - :ivar repair_enabled: Should automatic repairs run on this cluster? If omitted, this is true, - and should stay true unless you are running a hybrid cluster where you are already doing your - own repairs. - :vartype repair_enabled: bool - :ivar client_certificates: List of TLS certificates used to authorize clients connecting to the - cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if - clientCertificates is set, the managed Cassandra cluster will reject all connections not - bearing a TLS client certificate that can be validated from one or more of the public - certificates in this property. - :vartype client_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] - :ivar external_gossip_certificates: List of TLS certificates used to authorize gossip from - unmanaged data centers. The TLS certificates of all nodes in unmanaged data centers must be - verifiable using one of the certificates provided in this property. - :vartype external_gossip_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] - :ivar gossip_certificates: List of TLS certificates that unmanaged nodes must trust for gossip - with managed nodes. All managed nodes will present TLS client certificates that are verifiable - using one of the certificates provided in this property. - :vartype gossip_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] - :ivar external_seed_nodes: List of IP addresses of seed nodes in unmanaged data centers. These - will be added to the seed node lists of all managed nodes. - :vartype external_seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] - :ivar seed_nodes: List of IP addresses of seed nodes in the managed data centers. These should - be added to the seed node lists of all unmanaged nodes. - :vartype seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] - :ivar hours_between_backups: Number of hours to wait between taking a backup of the cluster. - :vartype hours_between_backups: int - :ivar deallocated: Whether the cluster and associated data centers has been deallocated. - :vartype deallocated: bool - :ivar cassandra_audit_logging_enabled: Whether Cassandra audit logging is enabled. - :vartype cassandra_audit_logging_enabled: bool - """ - - _validation = { - 'gossip_certificates': {'readonly': True}, - 'seed_nodes': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'restore_from_backup_id': {'key': 'restoreFromBackupId', 'type': 'str'}, - 'delegated_management_subnet_id': {'key': 'delegatedManagementSubnetId', 'type': 'str'}, - 'cassandra_version': {'key': 'cassandraVersion', 'type': 'str'}, - 'cluster_name_override': {'key': 'clusterNameOverride', 'type': 'str'}, - 'authentication_method': {'key': 'authenticationMethod', 'type': 'str'}, - 'initial_cassandra_admin_password': {'key': 'initialCassandraAdminPassword', 'type': 'str'}, - 'prometheus_endpoint': {'key': 'prometheusEndpoint', 'type': 'SeedNode'}, - 'repair_enabled': {'key': 'repairEnabled', 'type': 'bool'}, - 'client_certificates': {'key': 'clientCertificates', 'type': '[Certificate]'}, - 'external_gossip_certificates': {'key': 'externalGossipCertificates', 'type': '[Certificate]'}, - 'gossip_certificates': {'key': 'gossipCertificates', 'type': '[Certificate]'}, - 'external_seed_nodes': {'key': 'externalSeedNodes', 'type': '[SeedNode]'}, - 'seed_nodes': {'key': 'seedNodes', 'type': '[SeedNode]'}, - 'hours_between_backups': {'key': 'hoursBetweenBackups', 'type': 'int'}, - 'deallocated': {'key': 'deallocated', 'type': 'bool'}, - 'cassandra_audit_logging_enabled': {'key': 'cassandraAuditLoggingEnabled', 'type': 'bool'}, - } - - def __init__( - self, - *, - provisioning_state: Optional[Union[str, "ManagedCassandraProvisioningState"]] = None, - restore_from_backup_id: Optional[str] = None, - delegated_management_subnet_id: Optional[str] = None, - cassandra_version: Optional[str] = None, - cluster_name_override: Optional[str] = None, - authentication_method: Optional[Union[str, "AuthenticationMethod"]] = None, - initial_cassandra_admin_password: Optional[str] = None, - prometheus_endpoint: Optional["SeedNode"] = None, - repair_enabled: Optional[bool] = None, - client_certificates: Optional[List["Certificate"]] = None, - external_gossip_certificates: Optional[List["Certificate"]] = None, - external_seed_nodes: Optional[List["SeedNode"]] = None, - hours_between_backups: Optional[int] = None, - deallocated: Optional[bool] = None, - cassandra_audit_logging_enabled: Optional[bool] = None, - **kwargs - ): - """ - :keyword provisioning_state: The status of the resource at the time the operation was called. - Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :paramtype provisioning_state: str or - ~azure.mgmt.cosmosdb.models.ManagedCassandraProvisioningState - :keyword restore_from_backup_id: To create an empty cluster, omit this field or set it to null. - To restore a backup into a new cluster, set this field to the resource id of the backup. - :paramtype restore_from_backup_id: str - :keyword delegated_management_subnet_id: Resource id of a subnet that this cluster's management - service should have its network interface attached to. The subnet must be routable to all - subnets that will be delegated to data centers. The resource id must be of the form - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/virtualNetworks/:code:``/subnets/:code:``'. - :paramtype delegated_management_subnet_id: str - :keyword cassandra_version: Which version of Cassandra should this cluster converge to running - (e.g., 3.11). When updated, the cluster may take some time to migrate to the new version. - :paramtype cassandra_version: str - :keyword cluster_name_override: If you need to set the clusterName property in cassandra.yaml - to something besides the resource name of the cluster, set the value to use on this property. - :paramtype cluster_name_override: str - :keyword authentication_method: Which authentication method Cassandra should use to - authenticate clients. 'None' turns off authentication, so should not be used except in - emergencies. 'Cassandra' is the default password based authentication. The default is - 'Cassandra'. 'Ldap' is in preview. Possible values include: "None", "Cassandra", "Ldap". - :paramtype authentication_method: str or ~azure.mgmt.cosmosdb.models.AuthenticationMethod - :keyword initial_cassandra_admin_password: Initial password for clients connecting as admin to - the cluster. Should be changed after cluster creation. Returns null on GET. This field only - applies when the authenticationMethod field is 'Cassandra'. - :paramtype initial_cassandra_admin_password: str - :keyword prometheus_endpoint: Hostname or IP address where the Prometheus endpoint containing - data about the managed Cassandra nodes can be reached. - :paramtype prometheus_endpoint: ~azure.mgmt.cosmosdb.models.SeedNode - :keyword repair_enabled: Should automatic repairs run on this cluster? If omitted, this is - true, and should stay true unless you are running a hybrid cluster where you are already doing - your own repairs. - :paramtype repair_enabled: bool - :keyword client_certificates: List of TLS certificates used to authorize clients connecting to - the cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if - clientCertificates is set, the managed Cassandra cluster will reject all connections not - bearing a TLS client certificate that can be validated from one or more of the public - certificates in this property. - :paramtype client_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] - :keyword external_gossip_certificates: List of TLS certificates used to authorize gossip from - unmanaged data centers. The TLS certificates of all nodes in unmanaged data centers must be - verifiable using one of the certificates provided in this property. - :paramtype external_gossip_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] - :keyword external_seed_nodes: List of IP addresses of seed nodes in unmanaged data centers. - These will be added to the seed node lists of all managed nodes. - :paramtype external_seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] - :keyword hours_between_backups: Number of hours to wait between taking a backup of the cluster. - :paramtype hours_between_backups: int - :keyword deallocated: Whether the cluster and associated data centers has been deallocated. - :paramtype deallocated: bool - :keyword cassandra_audit_logging_enabled: Whether Cassandra audit logging is enabled. - :paramtype cassandra_audit_logging_enabled: bool - """ - super(ClusterResourceProperties, self).__init__(**kwargs) - self.provisioning_state = provisioning_state - self.restore_from_backup_id = restore_from_backup_id - self.delegated_management_subnet_id = delegated_management_subnet_id - self.cassandra_version = cassandra_version - self.cluster_name_override = cluster_name_override - self.authentication_method = authentication_method - self.initial_cassandra_admin_password = initial_cassandra_admin_password - self.prometheus_endpoint = prometheus_endpoint - self.repair_enabled = repair_enabled - self.client_certificates = client_certificates - self.external_gossip_certificates = external_gossip_certificates - self.gossip_certificates = None - self.external_seed_nodes = external_seed_nodes - self.seed_nodes = None - self.hours_between_backups = hours_between_backups - self.deallocated = deallocated - self.cassandra_audit_logging_enabled = cassandra_audit_logging_enabled - - -class Column(msrest.serialization.Model): - """Cosmos DB Cassandra table column. - - :ivar name: Name of the Cosmos DB Cassandra table column. - :vartype name: str - :ivar type: Type of the Cosmos DB Cassandra table column. - :vartype type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Name of the Cosmos DB Cassandra table column. - :paramtype name: str - :keyword type: Type of the Cosmos DB Cassandra table column. - :paramtype type: str - """ - super(Column, self).__init__(**kwargs) - self.name = name - self.type = type - - -class CommandOutput(msrest.serialization.Model): - """Response of /command api. - - :ivar command_output: Output of the command. - :vartype command_output: str - """ - - _attribute_map = { - 'command_output': {'key': 'commandOutput', 'type': 'str'}, - } - - def __init__( - self, - *, - command_output: Optional[str] = None, - **kwargs - ): - """ - :keyword command_output: Output of the command. - :paramtype command_output: str - """ - super(CommandOutput, self).__init__(**kwargs) - self.command_output = command_output - - -class CommandPostBody(msrest.serialization.Model): - """Specification of which command to run where. - - All required parameters must be populated in order to send to Azure. - - :ivar command: Required. The command which should be run. - :vartype command: str - :ivar arguments: The arguments for the command to be run. - :vartype arguments: dict[str, str] - :ivar host: Required. IP address of the cassandra host to run the command on. - :vartype host: str - :ivar cassandra_stop_start: If true, stops cassandra before executing the command and then - start it again. - :vartype cassandra_stop_start: bool - :ivar readwrite: If true, allows the command to *write* to the cassandra directory, otherwise - read-only. - :vartype readwrite: bool - """ - - _validation = { - 'command': {'required': True}, - 'host': {'required': True}, - } - - _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '{str}'}, - 'host': {'key': 'host', 'type': 'str'}, - 'cassandra_stop_start': {'key': 'cassandra-stop-start', 'type': 'bool'}, - 'readwrite': {'key': 'readwrite', 'type': 'bool'}, - } - - def __init__( - self, - *, - command: str, - host: str, - arguments: Optional[Dict[str, str]] = None, - cassandra_stop_start: Optional[bool] = None, - readwrite: Optional[bool] = None, - **kwargs - ): - """ - :keyword command: Required. The command which should be run. - :paramtype command: str - :keyword arguments: The arguments for the command to be run. - :paramtype arguments: dict[str, str] - :keyword host: Required. IP address of the cassandra host to run the command on. - :paramtype host: str - :keyword cassandra_stop_start: If true, stops cassandra before executing the command and then - start it again. - :paramtype cassandra_stop_start: bool - :keyword readwrite: If true, allows the command to *write* to the cassandra directory, - otherwise read-only. - :paramtype readwrite: bool - """ - super(CommandPostBody, self).__init__(**kwargs) - self.command = command - self.arguments = arguments - self.host = host - self.cassandra_stop_start = cassandra_stop_start - self.readwrite = readwrite - - -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 ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems(msrest.serialization.Model): - """ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems. - - :ivar address: The node's IP address. - :vartype address: str - :ivar state: The state of the node in Cassandra ring. Possible values include: "Normal", - "Leaving", "Joining", "Moving", "Stopped". - :vartype state: str or ~azure.mgmt.cosmosdb.models.NodeState - :ivar status: - :vartype status: str - :ivar load: The amount of file system data in the data directory (e.g., 47.66 kB), excluding - all content in the snapshots subdirectories. Because all SSTable data files are included, any - data that is not cleaned up (such as TTL-expired cells or tombstones) is counted. - :vartype load: str - :ivar tokens: List of tokens this node covers. - :vartype tokens: list[str] - :ivar size: - :vartype size: int - :ivar host_id: The network ID of the node. - :vartype host_id: str - :ivar rack: The rack this node is part of. - :vartype rack: str - :ivar timestamp: The timestamp at which that snapshot of these usage statistics were taken. - :vartype timestamp: str - :ivar disk_used_kb: The amount of disk used, in kB, of the directory /var/lib/cassandra. - :vartype disk_used_kb: long - :ivar disk_free_kb: The amount of disk free, in kB, of the directory /var/lib/cassandra. - :vartype disk_free_kb: long - :ivar memory_used_kb: Used memory (calculated as total - free - buffers - cache), in kB. - :vartype memory_used_kb: long - :ivar memory_buffers_and_cached_kb: Memory used by kernel buffers (Buffers in /proc/meminfo) - and page cache and slabs (Cached and SReclaimable in /proc/meminfo), in kB. - :vartype memory_buffers_and_cached_kb: long - :ivar memory_free_kb: Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. - :vartype memory_free_kb: long - :ivar memory_total_kb: Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. - :vartype memory_total_kb: long - :ivar cpu_usage: A float representing the current system-wide CPU utilization as a percentage. - :vartype cpu_usage: float - """ - - _attribute_map = { - 'address': {'key': 'address', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'load': {'key': 'load', 'type': 'str'}, - 'tokens': {'key': 'tokens', 'type': '[str]'}, - 'size': {'key': 'size', 'type': 'int'}, - 'host_id': {'key': 'hostID', 'type': 'str'}, - 'rack': {'key': 'rack', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'str'}, - 'disk_used_kb': {'key': 'diskUsedKB', 'type': 'long'}, - 'disk_free_kb': {'key': 'diskFreeKB', 'type': 'long'}, - 'memory_used_kb': {'key': 'memoryUsedKB', 'type': 'long'}, - 'memory_buffers_and_cached_kb': {'key': 'memoryBuffersAndCachedKB', 'type': 'long'}, - 'memory_free_kb': {'key': 'memoryFreeKB', 'type': 'long'}, - 'memory_total_kb': {'key': 'memoryTotalKB', 'type': 'long'}, - 'cpu_usage': {'key': 'cpuUsage', 'type': 'float'}, - } - - def __init__( - self, - *, - address: Optional[str] = None, - state: Optional[Union[str, "NodeState"]] = None, - status: Optional[str] = None, - load: Optional[str] = None, - tokens: Optional[List[str]] = None, - size: Optional[int] = None, - host_id: Optional[str] = None, - rack: Optional[str] = None, - timestamp: Optional[str] = None, - disk_used_kb: Optional[int] = None, - disk_free_kb: Optional[int] = None, - memory_used_kb: Optional[int] = None, - memory_buffers_and_cached_kb: Optional[int] = None, - memory_free_kb: Optional[int] = None, - memory_total_kb: Optional[int] = None, - cpu_usage: Optional[float] = None, - **kwargs - ): - """ - :keyword address: The node's IP address. - :paramtype address: str - :keyword state: The state of the node in Cassandra ring. Possible values include: "Normal", - "Leaving", "Joining", "Moving", "Stopped". - :paramtype state: str or ~azure.mgmt.cosmosdb.models.NodeState - :keyword status: - :paramtype status: str - :keyword load: The amount of file system data in the data directory (e.g., 47.66 kB), excluding - all content in the snapshots subdirectories. Because all SSTable data files are included, any - data that is not cleaned up (such as TTL-expired cells or tombstones) is counted. - :paramtype load: str - :keyword tokens: List of tokens this node covers. - :paramtype tokens: list[str] - :keyword size: - :paramtype size: int - :keyword host_id: The network ID of the node. - :paramtype host_id: str - :keyword rack: The rack this node is part of. - :paramtype rack: str - :keyword timestamp: The timestamp at which that snapshot of these usage statistics were taken. - :paramtype timestamp: str - :keyword disk_used_kb: The amount of disk used, in kB, of the directory /var/lib/cassandra. - :paramtype disk_used_kb: long - :keyword disk_free_kb: The amount of disk free, in kB, of the directory /var/lib/cassandra. - :paramtype disk_free_kb: long - :keyword memory_used_kb: Used memory (calculated as total - free - buffers - cache), in kB. - :paramtype memory_used_kb: long - :keyword memory_buffers_and_cached_kb: Memory used by kernel buffers (Buffers in /proc/meminfo) - and page cache and slabs (Cached and SReclaimable in /proc/meminfo), in kB. - :paramtype memory_buffers_and_cached_kb: long - :keyword memory_free_kb: Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. - :paramtype memory_free_kb: long - :keyword memory_total_kb: Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in - kB. - :paramtype memory_total_kb: long - :keyword cpu_usage: A float representing the current system-wide CPU utilization as a - percentage. - :paramtype cpu_usage: float - """ - super(ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems, self).__init__(**kwargs) - self.address = address - self.state = state - self.status = status - self.load = load - self.tokens = tokens - self.size = size - self.host_id = host_id - self.rack = rack - self.timestamp = timestamp - self.disk_used_kb = disk_used_kb - self.disk_free_kb = disk_free_kb - self.memory_used_kb = memory_used_kb - self.memory_buffers_and_cached_kb = memory_buffers_and_cached_kb - self.memory_free_kb = memory_free_kb - self.memory_total_kb = memory_total_kb - self.cpu_usage = cpu_usage - - -class CompositePath(msrest.serialization.Model): - """CompositePath. - - :ivar path: The path for which the indexing behavior applies to. Index paths typically start - with root and end with wildcard (/path/*). - :vartype path: str - :ivar order: Sort order for composite paths. Possible values include: "ascending", - "descending". - :vartype order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'order': {'key': 'order', 'type': 'str'}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - order: Optional[Union[str, "CompositePathSortOrder"]] = None, - **kwargs - ): - """ - :keyword path: The path for which the indexing behavior applies to. Index paths typically start - with root and end with wildcard (/path/*). - :paramtype path: str - :keyword order: Sort order for composite paths. Possible values include: "ascending", - "descending". - :paramtype order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder - """ - super(CompositePath, self).__init__(**kwargs) - self.path = path - self.order = order - - -class ConflictResolutionPolicy(msrest.serialization.Model): - """The conflict resolution policy for the container. - - :ivar mode: Indicates the conflict resolution mode. Possible values include: "LastWriterWins", - "Custom". Default value: "LastWriterWins". - :vartype mode: str or ~azure.mgmt.cosmosdb.models.ConflictResolutionMode - :ivar conflict_resolution_path: The conflict resolution path in the case of LastWriterWins - mode. - :vartype conflict_resolution_path: str - :ivar conflict_resolution_procedure: The procedure to resolve conflicts in the case of custom - mode. - :vartype conflict_resolution_procedure: str - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, - 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, - } - - def __init__( - self, - *, - mode: Optional[Union[str, "ConflictResolutionMode"]] = "LastWriterWins", - conflict_resolution_path: Optional[str] = None, - conflict_resolution_procedure: Optional[str] = None, - **kwargs - ): - """ - :keyword mode: Indicates the conflict resolution mode. Possible values include: - "LastWriterWins", "Custom". Default value: "LastWriterWins". - :paramtype mode: str or ~azure.mgmt.cosmosdb.models.ConflictResolutionMode - :keyword conflict_resolution_path: The conflict resolution path in the case of LastWriterWins - mode. - :paramtype conflict_resolution_path: str - :keyword conflict_resolution_procedure: The procedure to resolve conflicts in the case of - custom mode. - :paramtype conflict_resolution_procedure: str - """ - super(ConflictResolutionPolicy, self).__init__(**kwargs) - self.mode = mode - self.conflict_resolution_path = conflict_resolution_path - self.conflict_resolution_procedure = conflict_resolution_procedure - - -class ConnectionError(msrest.serialization.Model): - """ConnectionError. - - :ivar connection_state: The kind of connection error that occurred. Possible values include: - "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", - "InternalOperatorToDataCenterCertificateError", "InternalError". - :vartype connection_state: str or ~azure.mgmt.cosmosdb.models.ConnectionState - :ivar i_p_from: The IP of host that originated the failed connection. - :vartype i_p_from: str - :ivar i_p_to: The IP that the connection attempted to reach. - :vartype i_p_to: str - :ivar port: The TCP port the connection was attempted on. - :vartype port: int - :ivar exception: Detailed error message about the failed connection. - :vartype exception: str - """ - - _attribute_map = { - 'connection_state': {'key': 'connectionState', 'type': 'str'}, - 'i_p_from': {'key': 'iPFrom', 'type': 'str'}, - 'i_p_to': {'key': 'iPTo', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'exception': {'key': 'exception', 'type': 'str'}, - } - - def __init__( - self, - *, - connection_state: Optional[Union[str, "ConnectionState"]] = None, - i_p_from: Optional[str] = None, - i_p_to: Optional[str] = None, - port: Optional[int] = None, - exception: Optional[str] = None, - **kwargs - ): - """ - :keyword connection_state: The kind of connection error that occurred. Possible values include: - "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", - "InternalOperatorToDataCenterCertificateError", "InternalError". - :paramtype connection_state: str or ~azure.mgmt.cosmosdb.models.ConnectionState - :keyword i_p_from: The IP of host that originated the failed connection. - :paramtype i_p_from: str - :keyword i_p_to: The IP that the connection attempted to reach. - :paramtype i_p_to: str - :keyword port: The TCP port the connection was attempted on. - :paramtype port: int - :keyword exception: Detailed error message about the failed connection. - :paramtype exception: str - """ - super(ConnectionError, self).__init__(**kwargs) - self.connection_state = connection_state - self.i_p_from = i_p_from - self.i_p_to = i_p_to - self.port = port - self.exception = exception - - -class ConsistencyPolicy(msrest.serialization.Model): - """The consistency policy for the Cosmos DB database account. - - All required parameters must be populated in order to send to Azure. - - :ivar default_consistency_level: Required. The default consistency level and configuration - settings of the Cosmos DB account. Possible values include: "Eventual", "Session", - "BoundedStaleness", "Strong", "ConsistentPrefix". - :vartype default_consistency_level: str or ~azure.mgmt.cosmosdb.models.DefaultConsistencyLevel - :ivar max_staleness_prefix: When used with the Bounded Staleness consistency level, this value - represents the number of stale requests tolerated. Accepted range for this value is 1 – - 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - :vartype max_staleness_prefix: long - :ivar max_interval_in_seconds: When used with the Bounded Staleness consistency level, this - value represents the time amount of staleness (in seconds) tolerated. Accepted range for this - value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - :vartype max_interval_in_seconds: int - """ - - _validation = { - 'default_consistency_level': {'required': True}, - 'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1}, - 'max_interval_in_seconds': {'maximum': 86400, 'minimum': 5}, - } - - _attribute_map = { - 'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'str'}, - 'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'}, - 'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'}, - } - - def __init__( - self, - *, - default_consistency_level: Union[str, "DefaultConsistencyLevel"], - max_staleness_prefix: Optional[int] = None, - max_interval_in_seconds: Optional[int] = None, - **kwargs - ): - """ - :keyword default_consistency_level: Required. The default consistency level and configuration - settings of the Cosmos DB account. Possible values include: "Eventual", "Session", - "BoundedStaleness", "Strong", "ConsistentPrefix". - :paramtype default_consistency_level: str or - ~azure.mgmt.cosmosdb.models.DefaultConsistencyLevel - :keyword max_staleness_prefix: When used with the Bounded Staleness consistency level, this - value represents the number of stale requests tolerated. Accepted range for this value is 1 – - 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - :paramtype max_staleness_prefix: long - :keyword max_interval_in_seconds: When used with the Bounded Staleness consistency level, this - value represents the time amount of staleness (in seconds) tolerated. Accepted range for this - value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - :paramtype max_interval_in_seconds: int - """ - super(ConsistencyPolicy, self).__init__(**kwargs) - self.default_consistency_level = default_consistency_level - self.max_staleness_prefix = max_staleness_prefix - self.max_interval_in_seconds = max_interval_in_seconds - - -class ContainerPartitionKey(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. - - :ivar paths: List of paths using which data within the container can be partitioned. - :vartype paths: list[str] - :ivar 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". - :vartype kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind - :ivar version: Indicates the version of the partition key definition. - :vartype 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__( - self, - *, - paths: Optional[List[str]] = None, - kind: Optional[Union[str, "PartitionKind"]] = "Hash", - version: Optional[int] = None, - **kwargs - ): - """ - :keyword paths: List of paths using which data within the container can be partitioned. - :paramtype paths: list[str] - :keyword 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". - :paramtype kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind - :keyword version: Indicates the version of the partition key definition. - :paramtype version: int - """ - super(ContainerPartitionKey, self).__init__(**kwargs) - self.paths = paths - self.kind = kind - self.version = version - self.system_key = None - - -class ContinuousBackupInformation(msrest.serialization.Model): - """Information about the status of continuous backups. - - :ivar latest_restorable_timestamp: The latest restorable timestamp for a resource. - :vartype latest_restorable_timestamp: str - """ - - _attribute_map = { - 'latest_restorable_timestamp': {'key': 'latestRestorableTimestamp', 'type': 'str'}, - } - - def __init__( - self, - *, - latest_restorable_timestamp: Optional[str] = None, - **kwargs - ): - """ - :keyword latest_restorable_timestamp: The latest restorable timestamp for a resource. - :paramtype latest_restorable_timestamp: str - """ - super(ContinuousBackupInformation, self).__init__(**kwargs) - self.latest_restorable_timestamp = latest_restorable_timestamp - - -class ContinuousBackupRestoreLocation(msrest.serialization.Model): - """Properties of the regional restorable account. - - :ivar location: The name of the continuous backup restore location. - :vartype location: str - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - **kwargs - ): - """ - :keyword location: The name of the continuous backup restore location. - :paramtype location: str - """ - super(ContinuousBackupRestoreLocation, self).__init__(**kwargs) - self.location = location - - -class ContinuousModeBackupPolicy(BackupPolicy): - """The object representing continuous mode backup policy. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Describes the mode of backups.Constant filled by server. Possible values - include: "Periodic", "Continuous". - :vartype type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType - :ivar migration_state: The object representing the state of the migration between the backup - policies. - :vartype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState - :ivar continuous_mode_properties: Configuration values for continuous mode backup. - :vartype continuous_mode_properties: ~azure.mgmt.cosmosdb.models.ContinuousModeProperties - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'migration_state': {'key': 'migrationState', 'type': 'BackupPolicyMigrationState'}, - 'continuous_mode_properties': {'key': 'continuousModeProperties', 'type': 'ContinuousModeProperties'}, - } - - def __init__( - self, - *, - migration_state: Optional["BackupPolicyMigrationState"] = None, - continuous_mode_properties: Optional["ContinuousModeProperties"] = None, - **kwargs - ): - """ - :keyword migration_state: The object representing the state of the migration between the backup - policies. - :paramtype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState - :keyword continuous_mode_properties: Configuration values for continuous mode backup. - :paramtype continuous_mode_properties: ~azure.mgmt.cosmosdb.models.ContinuousModeProperties - """ - super(ContinuousModeBackupPolicy, self).__init__(migration_state=migration_state, **kwargs) - self.type = 'Continuous' # type: str - self.continuous_mode_properties = continuous_mode_properties - - -class ContinuousModeProperties(msrest.serialization.Model): - """Configuration values for periodic mode backup. - - :ivar tier: Enum to indicate type of Continuos backup mode. Possible values include: - "Continuous7Days", "Continuous30Days". - :vartype tier: str or ~azure.mgmt.cosmosdb.models.ContinuousTier - """ - - _attribute_map = { - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - *, - tier: Optional[Union[str, "ContinuousTier"]] = None, - **kwargs - ): - """ - :keyword tier: Enum to indicate type of Continuos backup mode. Possible values include: - "Continuous7Days", "Continuous30Days". - :paramtype tier: str or ~azure.mgmt.cosmosdb.models.ContinuousTier - """ - super(ContinuousModeProperties, self).__init__(**kwargs) - self.tier = tier - - -class CorsPolicy(msrest.serialization.Model): - """The CORS policy for the Cosmos DB database account. - - All required parameters must be populated in order to send to Azure. - - :ivar allowed_origins: Required. The origin domains that are permitted to make a request - against the service via CORS. - :vartype allowed_origins: str - :ivar allowed_methods: The methods (HTTP request verbs) that the origin domain may use for a - CORS request. - :vartype allowed_methods: str - :ivar allowed_headers: The request headers that the origin domain may specify on the CORS - request. - :vartype allowed_headers: str - :ivar exposed_headers: The response headers that may be sent in the response to the CORS - request and exposed by the browser to the request issuer. - :vartype exposed_headers: str - :ivar max_age_in_seconds: The maximum amount time that a browser should cache the preflight - OPTIONS request. - :vartype max_age_in_seconds: long - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'max_age_in_seconds': {'maximum': 2147483647, 'minimum': 1}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': 'str'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': 'str'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': 'str'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': 'str'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'long'}, - } - - def __init__( - self, - *, - allowed_origins: str, - allowed_methods: Optional[str] = None, - allowed_headers: Optional[str] = None, - exposed_headers: Optional[str] = None, - max_age_in_seconds: Optional[int] = None, - **kwargs - ): - """ - :keyword allowed_origins: Required. The origin domains that are permitted to make a request - against the service via CORS. - :paramtype allowed_origins: str - :keyword allowed_methods: The methods (HTTP request verbs) that the origin domain may use for a - CORS request. - :paramtype allowed_methods: str - :keyword allowed_headers: The request headers that the origin domain may specify on the CORS - request. - :paramtype allowed_headers: str - :keyword exposed_headers: The response headers that may be sent in the response to the CORS - request and exposed by the browser to the request issuer. - :paramtype exposed_headers: str - :keyword max_age_in_seconds: The maximum amount time that a browser should cache the preflight - OPTIONS request. - :paramtype max_age_in_seconds: long - """ - super(CorsPolicy, self).__init__(**kwargs) - self.allowed_origins = allowed_origins - self.allowed_methods = allowed_methods - self.allowed_headers = allowed_headers - self.exposed_headers = exposed_headers - self.max_age_in_seconds = max_age_in_seconds - - -class CosmosCassandraDataTransferDataSourceSink(DataTransferDataSourceSink): - """A CosmosDB Cassandra API data source/sink. - - All required parameters must be populated in order to send to Azure. - - :ivar component: Required. Constant filled by server. Possible values include: - "CosmosDBCassandra", "CosmosDBSql", "AzureBlobStorage". Default value: "CosmosDBCassandra". - :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent - :ivar keyspace_name: Required. - :vartype keyspace_name: str - :ivar table_name: Required. - :vartype table_name: str - """ - - _validation = { - 'component': {'required': True}, - 'keyspace_name': {'required': True}, - 'table_name': {'required': True}, - } - - _attribute_map = { - 'component': {'key': 'component', 'type': 'str'}, - 'keyspace_name': {'key': 'keyspaceName', 'type': 'str'}, - 'table_name': {'key': 'tableName', 'type': 'str'}, - } - - def __init__( - self, - *, - keyspace_name: str, - table_name: str, - **kwargs - ): - """ - :keyword keyspace_name: Required. - :paramtype keyspace_name: str - :keyword table_name: Required. - :paramtype table_name: str - """ - super(CosmosCassandraDataTransferDataSourceSink, self).__init__(**kwargs) - self.component = 'CosmosDBCassandra' # type: str - self.keyspace_name = keyspace_name - self.table_name = table_name - - -class CosmosSqlDataTransferDataSourceSink(DataTransferDataSourceSink): - """A CosmosDB Cassandra API data source/sink. - - All required parameters must be populated in order to send to Azure. - - :ivar component: Required. Constant filled by server. Possible values include: - "CosmosDBCassandra", "CosmosDBSql", "AzureBlobStorage". Default value: "CosmosDBCassandra". - :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent - :ivar database_name: Required. - :vartype database_name: str - :ivar container_name: Required. - :vartype container_name: str - """ - - _validation = { - 'component': {'required': True}, - 'database_name': {'required': True}, - 'container_name': {'required': True}, - } - - _attribute_map = { - 'component': {'key': 'component', 'type': 'str'}, - 'database_name': {'key': 'databaseName', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - } - - def __init__( - self, - *, - database_name: str, - container_name: str, - **kwargs - ): - """ - :keyword database_name: Required. - :paramtype database_name: str - :keyword container_name: Required. - :paramtype container_name: str - """ - super(CosmosSqlDataTransferDataSourceSink, self).__init__(**kwargs) - self.component = 'CosmosDBSql' # type: str - self.database_name = database_name - self.container_name = container_name - - -class CreateJobRequest(ARMProxyResource): - """Parameters to create Data Transfer Job. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar properties: Required. Data Transfer Create Job Properties. - :vartype properties: ~azure.mgmt.cosmosdb.models.DataTransferJobProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DataTransferJobProperties'}, - } - - def __init__( - self, - *, - properties: "DataTransferJobProperties", - **kwargs - ): - """ - :keyword properties: Required. Data Transfer Create Job Properties. - :paramtype properties: ~azure.mgmt.cosmosdb.models.DataTransferJobProperties - """ - super(CreateJobRequest, self).__init__(**kwargs) - self.properties = properties - - -class CreateUpdateOptions(msrest.serialization.Model): - """CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput". - - :ivar throughput: Request Units per second. For example, "throughput": 10000. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - - _attribute_map = { - 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, - } - - def __init__( - self, - *, - throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, - **kwargs - ): - """ - :keyword throughput: Request Units per second. For example, "throughput": 10000. - :paramtype throughput: int - :keyword autoscale_settings: Specifies the Autoscale settings. - :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - super(CreateUpdateOptions, self).__init__(**kwargs) - self.throughput = throughput - self.autoscale_settings = autoscale_settings - - -class DatabaseAccountConnectionString(msrest.serialization.Model): - """Connection string for the Cosmos DB account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar connection_string: Value of the connection string. - :vartype connection_string: str - :ivar description: Description of the connection string. - :vartype description: str - """ - - _validation = { - 'connection_string': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DatabaseAccountConnectionString, self).__init__(**kwargs) - self.connection_string = None - self.description = None - - -class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB database accounts. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar kind: Indicates the type of database account. This can only be set at database account - creation. Possible values include: "GlobalDocumentDB", "MongoDB", "Parse". - :vartype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :ivar consistency_policy: The consistency policy for the Cosmos DB account. - :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :ivar locations: Required. An array that contains the georeplication locations enabled for the - Cosmos DB account. - :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar database_account_offer_type: The offer type for the database. Has constant value: - "Standard". - :vartype database_account_offer_type: str - :ivar ip_rules: List of IpRules. - :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] - :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :vartype is_virtual_network_filter_enabled: bool - :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the - account. - :vartype enable_automatic_failover: bool - :ivar capabilities: List of Cosmos DB capabilities for the account. - :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB - account. - :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] - :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. - :vartype enable_multiple_write_locations: bool - :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. - :vartype enable_cassandra_connector: bool - :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. Possible values include: "Small". - :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer - :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources - (databases, containers, throughput) via account keys. - :vartype disable_key_based_metadata_write_access: bool - :ivar key_vault_key_uri: The URI of the key vault. - :vartype key_vault_key_uri: str - :ivar default_identity: The default identity for accessing key vault used in features like - customer managed keys. The default identity needs to be explicitly set by the users. It can be - "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :vartype default_identity: str - :ivar public_network_access: Whether requests from Public Network are allowed. Possible values - include: "Enabled", "Disabled". - :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess - :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. - :vartype enable_free_tier: bool - :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. - :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties - :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :vartype enable_analytical_storage: bool - :ivar analytical_storage_configuration: Analytical storage specific properties. - :vartype analytical_storage_configuration: - ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration - :ivar create_mode: Enum to indicate the mode of account creation. Possible values include: - "Default", "Restore". Default value: "Default". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :ivar backup_policy: The object representing the policy for taking backups on an account. - :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy - :ivar cors: The CORS policy for the Cosmos DB database account. - :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] - :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. - Possible values include: "None", "AzureServices". - :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass - :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl - Bypass for the Cosmos DB account. - :vartype network_acl_bypass_resource_ids: list[str] - :ivar diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :vartype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters - :ivar capacity: The object that represents all properties related to capacity enforcement on an - account. - :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :ivar enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :vartype enable_materialized_views: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'locations': {'required': True}, - 'database_account_offer_type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, - 'locations': {'key': 'properties.locations', 'type': '[Location]'}, - 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, - 'ip_rules': {'key': 'properties.ipRules', 'type': '[IpAddressOrRange]'}, - 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, - 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, - 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, - 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, - 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, - 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, - 'key_vault_key_uri': {'key': 'properties.keyVaultKeyUri', 'type': 'str'}, - 'default_identity': {'key': 'properties.defaultIdentity', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, - 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, - 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, - 'analytical_storage_configuration': {'key': 'properties.analyticalStorageConfiguration', 'type': 'AnalyticalStorageConfiguration'}, - 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, - '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]'}, - 'diagnostic_log_settings': {'key': 'properties.diagnosticLogSettings', 'type': 'DiagnosticLogSettings'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'restore_parameters': {'key': 'properties.restoreParameters', 'type': 'RestoreParameters'}, - 'capacity': {'key': 'properties.capacity', 'type': 'Capacity'}, - 'enable_materialized_views': {'key': 'properties.enableMaterializedViews', 'type': 'bool'}, - } - - database_account_offer_type = "Standard" - - def __init__( - self, - *, - locations: List["Location"], - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - kind: Optional[Union[str, "DatabaseAccountKind"]] = None, - consistency_policy: Optional["ConsistencyPolicy"] = None, - ip_rules: Optional[List["IpAddressOrRange"]] = None, - is_virtual_network_filter_enabled: Optional[bool] = None, - enable_automatic_failover: Optional[bool] = None, - capabilities: Optional[List["Capability"]] = None, - virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, - enable_multiple_write_locations: Optional[bool] = None, - enable_cassandra_connector: Optional[bool] = None, - connector_offer: Optional[Union[str, "ConnectorOffer"]] = None, - disable_key_based_metadata_write_access: Optional[bool] = None, - key_vault_key_uri: Optional[str] = None, - default_identity: Optional[str] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, - enable_free_tier: Optional[bool] = None, - api_properties: Optional["ApiProperties"] = None, - enable_analytical_storage: Optional[bool] = None, - analytical_storage_configuration: Optional["AnalyticalStorageConfiguration"] = None, - create_mode: Optional[Union[str, "CreateMode"]] = "Default", - 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, - diagnostic_log_settings: Optional["DiagnosticLogSettings"] = None, - disable_local_auth: Optional[bool] = None, - restore_parameters: Optional["RestoreParameters"] = None, - capacity: Optional["Capacity"] = None, - enable_materialized_views: Optional[bool] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword kind: Indicates the type of database account. This can only be set at database account - creation. Possible values include: "GlobalDocumentDB", "MongoDB", "Parse". - :paramtype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :keyword consistency_policy: The consistency policy for the Cosmos DB account. - :paramtype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :keyword locations: Required. An array that contains the georeplication locations enabled for - the Cosmos DB account. - :paramtype locations: list[~azure.mgmt.cosmosdb.models.Location] - :keyword ip_rules: List of IpRules. - :paramtype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] - :keyword is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :paramtype is_virtual_network_filter_enabled: bool - :keyword enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the - account. - :paramtype enable_automatic_failover: bool - :keyword capabilities: List of Cosmos DB capabilities for the account. - :paramtype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :keyword virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB - account. - :paramtype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] - :keyword enable_multiple_write_locations: Enables the account to write in multiple locations. - :paramtype enable_multiple_write_locations: bool - :keyword enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* - account. - :paramtype enable_cassandra_connector: bool - :keyword connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. Possible values include: "Small". - :paramtype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer - :keyword disable_key_based_metadata_write_access: Disable write operations on metadata - resources (databases, containers, throughput) via account keys. - :paramtype disable_key_based_metadata_write_access: bool - :keyword key_vault_key_uri: The URI of the key vault. - :paramtype key_vault_key_uri: str - :keyword default_identity: The default identity for accessing key vault used in features like - customer managed keys. The default identity needs to be explicitly set by the users. It can be - "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :paramtype default_identity: str - :keyword public_network_access: Whether requests from Public Network are allowed. Possible - values include: "Enabled", "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess - :keyword enable_free_tier: Flag to indicate whether Free Tier is enabled. - :paramtype enable_free_tier: bool - :keyword api_properties: API specific properties. Currently, supported only for MongoDB API. - :paramtype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties - :keyword enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :paramtype enable_analytical_storage: bool - :keyword analytical_storage_configuration: Analytical storage specific properties. - :paramtype analytical_storage_configuration: - ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration - :keyword create_mode: Enum to indicate the mode of account creation. Possible values include: - "Default", "Restore". Default value: "Default". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :keyword backup_policy: The object representing the policy for taking backups on an account. - :paramtype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy - :keyword cors: The CORS policy for the Cosmos DB database account. - :paramtype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] - :keyword network_acl_bypass: Indicates what services are allowed to bypass firewall checks. - Possible values include: "None", "AzureServices". - :paramtype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass - :keyword network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network - Acl Bypass for the Cosmos DB account. - :paramtype network_acl_bypass_resource_ids: list[str] - :keyword diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :paramtype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings - :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :paramtype disable_local_auth: bool - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters - :keyword capacity: The object that represents all properties related to capacity enforcement on - an account. - :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :keyword enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :paramtype enable_materialized_views: bool - """ - super(DatabaseAccountCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.kind = kind - self.consistency_policy = consistency_policy - self.locations = locations - self.ip_rules = ip_rules - self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled - self.enable_automatic_failover = enable_automatic_failover - self.capabilities = capabilities - self.virtual_network_rules = virtual_network_rules - self.enable_multiple_write_locations = enable_multiple_write_locations - self.enable_cassandra_connector = enable_cassandra_connector - self.connector_offer = connector_offer - self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access - self.key_vault_key_uri = key_vault_key_uri - self.default_identity = default_identity - self.public_network_access = public_network_access - self.enable_free_tier = enable_free_tier - self.api_properties = api_properties - self.enable_analytical_storage = enable_analytical_storage - self.analytical_storage_configuration = analytical_storage_configuration - self.create_mode = create_mode - 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 - self.diagnostic_log_settings = diagnostic_log_settings - self.disable_local_auth = disable_local_auth - self.restore_parameters = restore_parameters - self.capacity = capacity - self.enable_materialized_views = enable_materialized_views - - -class DatabaseAccountGetResults(ARMResourceProperties): - """An Azure Cosmos DB database account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar kind: Indicates the type of database account. This can only be set at database account - creation. Possible values include: "GlobalDocumentDB", "MongoDB", "Parse". - :vartype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :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 - the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is - active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB - account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – - the Cosmos DB account deletion failed. - :vartype provisioning_state: str - :ivar document_endpoint: The connection endpoint for the Cosmos DB database account. - :vartype document_endpoint: str - :ivar database_account_offer_type: The offer type for the Cosmos DB database account. Default - value: Standard. The only acceptable values to pass in are None and "Standard". The default - value is None. - :vartype database_account_offer_type: str - :ivar ip_rules: List of IpRules. - :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] - :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :vartype is_virtual_network_filter_enabled: bool - :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the - account. - :vartype enable_automatic_failover: bool - :ivar consistency_policy: The consistency policy for the Cosmos DB database account. - :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :ivar capabilities: List of Cosmos DB capabilities for the account. - :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :ivar write_locations: An array that contains the write location for the Cosmos DB account. - :vartype write_locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar read_locations: An array that contains of the read locations enabled for the Cosmos DB - account. - :vartype read_locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar locations: An array that contains all of the locations enabled for the Cosmos DB account. - :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar failover_policies: An array that contains the regions ordered by their failover - priorities. - :vartype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] - :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB - account. - :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] - :ivar private_endpoint_connections: List of Private Endpoint Connections configured for the - Cosmos DB account. - :vartype private_endpoint_connections: - list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] - :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. - :vartype enable_multiple_write_locations: bool - :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. - :vartype enable_cassandra_connector: bool - :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. Possible values include: "Small". - :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer - :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources - (databases, containers, throughput) via account keys. - :vartype disable_key_based_metadata_write_access: bool - :ivar key_vault_key_uri: The URI of the key vault. - :vartype key_vault_key_uri: str - :ivar default_identity: The default identity for accessing key vault used in features like - customer managed keys. The default identity needs to be explicitly set by the users. It can be - "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :vartype default_identity: str - :ivar public_network_access: Whether requests from Public Network are allowed. Possible values - include: "Enabled", "Disabled". - :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess - :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. - :vartype enable_free_tier: bool - :ivar api_properties: API specific properties. - :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties - :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :vartype enable_analytical_storage: bool - :ivar analytical_storage_configuration: Analytical storage specific properties. - :vartype analytical_storage_configuration: - ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration - :ivar instance_id: A unique identifier assigned to the database account. - :vartype instance_id: str - :ivar create_mode: Enum to indicate the mode of account creation. Possible values include: - "Default", "Restore". Default value: "Default". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters - :ivar backup_policy: The object representing the policy for taking backups on an account. - :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy - :ivar cors: The CORS policy for the Cosmos DB database account. - :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] - :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. - Possible values include: "None", "AzureServices". - :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass - :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl - Bypass for the Cosmos DB account. - :vartype network_acl_bypass_resource_ids: list[str] - :ivar diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :vartype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool - :ivar capacity: The object that represents all properties related to capacity enforcement on an - account. - :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :ivar enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :vartype enable_materialized_views: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'document_endpoint': {'readonly': True}, - 'database_account_offer_type': {'readonly': True}, - 'write_locations': {'readonly': True}, - 'read_locations': {'readonly': True}, - 'locations': {'readonly': True}, - 'failover_policies': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'instance_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, - 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, - 'ip_rules': {'key': 'properties.ipRules', 'type': '[IpAddressOrRange]'}, - 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, - 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, - 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, - 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, - 'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'}, - 'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'}, - 'locations': {'key': 'properties.locations', 'type': '[Location]'}, - 'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, - 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, - 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, - 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, - 'key_vault_key_uri': {'key': 'properties.keyVaultKeyUri', 'type': 'str'}, - 'default_identity': {'key': 'properties.defaultIdentity', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, - 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, - 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, - 'analytical_storage_configuration': {'key': 'properties.analyticalStorageConfiguration', 'type': 'AnalyticalStorageConfiguration'}, - 'instance_id': {'key': 'properties.instanceId', 'type': 'str'}, - 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, - 'restore_parameters': {'key': 'properties.restoreParameters', 'type': 'RestoreParameters'}, - '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]'}, - 'diagnostic_log_settings': {'key': 'properties.diagnosticLogSettings', 'type': 'DiagnosticLogSettings'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'capacity': {'key': 'properties.capacity', 'type': 'Capacity'}, - 'enable_materialized_views': {'key': 'properties.enableMaterializedViews', 'type': 'bool'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - kind: Optional[Union[str, "DatabaseAccountKind"]] = None, - ip_rules: Optional[List["IpAddressOrRange"]] = None, - is_virtual_network_filter_enabled: Optional[bool] = None, - enable_automatic_failover: Optional[bool] = None, - consistency_policy: Optional["ConsistencyPolicy"] = None, - capabilities: Optional[List["Capability"]] = None, - virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, - enable_multiple_write_locations: Optional[bool] = None, - enable_cassandra_connector: Optional[bool] = None, - connector_offer: Optional[Union[str, "ConnectorOffer"]] = None, - disable_key_based_metadata_write_access: Optional[bool] = None, - key_vault_key_uri: Optional[str] = None, - default_identity: Optional[str] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, - enable_free_tier: Optional[bool] = None, - api_properties: Optional["ApiProperties"] = None, - enable_analytical_storage: Optional[bool] = None, - analytical_storage_configuration: Optional["AnalyticalStorageConfiguration"] = None, - create_mode: Optional[Union[str, "CreateMode"]] = "Default", - restore_parameters: Optional["RestoreParameters"] = 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, - diagnostic_log_settings: Optional["DiagnosticLogSettings"] = None, - disable_local_auth: Optional[bool] = None, - capacity: Optional["Capacity"] = None, - enable_materialized_views: Optional[bool] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword kind: Indicates the type of database account. This can only be set at database account - creation. Possible values include: "GlobalDocumentDB", "MongoDB", "Parse". - :paramtype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :keyword ip_rules: List of IpRules. - :paramtype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] - :keyword is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :paramtype is_virtual_network_filter_enabled: bool - :keyword enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the - account. - :paramtype enable_automatic_failover: bool - :keyword consistency_policy: The consistency policy for the Cosmos DB database account. - :paramtype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :keyword capabilities: List of Cosmos DB capabilities for the account. - :paramtype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :keyword virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB - account. - :paramtype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] - :keyword enable_multiple_write_locations: Enables the account to write in multiple locations. - :paramtype enable_multiple_write_locations: bool - :keyword enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* - account. - :paramtype enable_cassandra_connector: bool - :keyword connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. Possible values include: "Small". - :paramtype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer - :keyword disable_key_based_metadata_write_access: Disable write operations on metadata - resources (databases, containers, throughput) via account keys. - :paramtype disable_key_based_metadata_write_access: bool - :keyword key_vault_key_uri: The URI of the key vault. - :paramtype key_vault_key_uri: str - :keyword default_identity: The default identity for accessing key vault used in features like - customer managed keys. The default identity needs to be explicitly set by the users. It can be - "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :paramtype default_identity: str - :keyword public_network_access: Whether requests from Public Network are allowed. Possible - values include: "Enabled", "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess - :keyword enable_free_tier: Flag to indicate whether Free Tier is enabled. - :paramtype enable_free_tier: bool - :keyword api_properties: API specific properties. - :paramtype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties - :keyword enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :paramtype enable_analytical_storage: bool - :keyword analytical_storage_configuration: Analytical storage specific properties. - :paramtype analytical_storage_configuration: - ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration - :keyword create_mode: Enum to indicate the mode of account creation. Possible values include: - "Default", "Restore". Default value: "Default". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters - :keyword backup_policy: The object representing the policy for taking backups on an account. - :paramtype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy - :keyword cors: The CORS policy for the Cosmos DB database account. - :paramtype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] - :keyword network_acl_bypass: Indicates what services are allowed to bypass firewall checks. - Possible values include: "None", "AzureServices". - :paramtype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass - :keyword network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network - Acl Bypass for the Cosmos DB account. - :paramtype network_acl_bypass_resource_ids: list[str] - :keyword diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :paramtype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings - :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :paramtype disable_local_auth: bool - :keyword capacity: The object that represents all properties related to capacity enforcement on - an account. - :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :keyword enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :paramtype enable_materialized_views: bool - """ - super(DatabaseAccountGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.kind = kind - self.system_data = None - self.provisioning_state = None - self.document_endpoint = None - self.database_account_offer_type = None - self.ip_rules = ip_rules - self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled - self.enable_automatic_failover = enable_automatic_failover - self.consistency_policy = consistency_policy - self.capabilities = capabilities - self.write_locations = None - self.read_locations = None - self.locations = None - self.failover_policies = None - self.virtual_network_rules = virtual_network_rules - self.private_endpoint_connections = None - self.enable_multiple_write_locations = enable_multiple_write_locations - self.enable_cassandra_connector = enable_cassandra_connector - self.connector_offer = connector_offer - self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access - self.key_vault_key_uri = key_vault_key_uri - self.default_identity = default_identity - self.public_network_access = public_network_access - self.enable_free_tier = enable_free_tier - self.api_properties = api_properties - self.enable_analytical_storage = enable_analytical_storage - self.analytical_storage_configuration = analytical_storage_configuration - self.instance_id = None - self.create_mode = create_mode - self.restore_parameters = restore_parameters - 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 - self.diagnostic_log_settings = diagnostic_log_settings - self.disable_local_auth = disable_local_auth - self.capacity = capacity - self.enable_materialized_views = enable_materialized_views - - -class DatabaseAccountListConnectionStringsResult(msrest.serialization.Model): - """The connection strings for the given database account. - - :ivar connection_strings: An array that contains the connection strings for the Cosmos DB - account. - :vartype connection_strings: list[~azure.mgmt.cosmosdb.models.DatabaseAccountConnectionString] - """ - - _attribute_map = { - 'connection_strings': {'key': 'connectionStrings', 'type': '[DatabaseAccountConnectionString]'}, - } - - def __init__( - self, - *, - connection_strings: Optional[List["DatabaseAccountConnectionString"]] = None, - **kwargs - ): - """ - :keyword connection_strings: An array that contains the connection strings for the Cosmos DB - account. - :paramtype connection_strings: - list[~azure.mgmt.cosmosdb.models.DatabaseAccountConnectionString] - """ - super(DatabaseAccountListConnectionStringsResult, self).__init__(**kwargs) - self.connection_strings = connection_strings - - -class DatabaseAccountListReadOnlyKeysResult(msrest.serialization.Model): - """The read-only access keys for the given database account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. - :vartype primary_readonly_master_key: str - :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. - :vartype secondary_readonly_master_key: str - """ - - _validation = { - 'primary_readonly_master_key': {'readonly': True}, - 'secondary_readonly_master_key': {'readonly': True}, - } - - _attribute_map = { - 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, - 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DatabaseAccountListReadOnlyKeysResult, self).__init__(**kwargs) - self.primary_readonly_master_key = None - self.secondary_readonly_master_key = None - - -class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): - """The access keys for the given database account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. - :vartype primary_readonly_master_key: str - :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. - :vartype secondary_readonly_master_key: str - :ivar primary_master_key: Base 64 encoded value of the primary read-write key. - :vartype primary_master_key: str - :ivar secondary_master_key: Base 64 encoded value of the secondary read-write key. - :vartype secondary_master_key: str - """ - - _validation = { - 'primary_readonly_master_key': {'readonly': True}, - 'secondary_readonly_master_key': {'readonly': True}, - 'primary_master_key': {'readonly': True}, - 'secondary_master_key': {'readonly': True}, - } - - _attribute_map = { - 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, - 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, - 'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'}, - 'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DatabaseAccountListKeysResult, self).__init__(**kwargs) - self.primary_master_key = None - self.secondary_master_key = None - - -class DatabaseAccountRegenerateKeyParameters(msrest.serialization.Model): - """Parameters to regenerate the keys within the database account. - - All required parameters must be populated in order to send to Azure. - - :ivar key_kind: Required. The access key to regenerate. Possible values include: "primary", - "secondary", "primaryReadonly", "secondaryReadonly". - :vartype key_kind: str or ~azure.mgmt.cosmosdb.models.KeyKind - """ - - _validation = { - 'key_kind': {'required': True}, - } - - _attribute_map = { - 'key_kind': {'key': 'keyKind', 'type': 'str'}, - } - - def __init__( - self, - *, - key_kind: Union[str, "KeyKind"], - **kwargs - ): - """ - :keyword key_kind: Required. The access key to regenerate. Possible values include: "primary", - "secondary", "primaryReadonly", "secondaryReadonly". - :paramtype key_kind: str or ~azure.mgmt.cosmosdb.models.KeyKind - """ - super(DatabaseAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_kind = key_kind - - -class DatabaseAccountsListResult(msrest.serialization.Model): - """The List operation response, that contains the database accounts and their properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of database account and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DatabaseAccountGetResults]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DatabaseAccountsListResult, self).__init__(**kwargs) - self.value = None - - -class DatabaseAccountUpdateParameters(msrest.serialization.Model): - """Parameters for patching Azure Cosmos DB database account properties. - - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar consistency_policy: The consistency policy for the Cosmos DB account. - :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB - account. - :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar ip_rules: List of IpRules. - :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] - :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :vartype is_virtual_network_filter_enabled: bool - :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the - account. - :vartype enable_automatic_failover: bool - :ivar capabilities: List of Cosmos DB capabilities for the account. - :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB - account. - :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] - :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. - :vartype enable_multiple_write_locations: bool - :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. - :vartype enable_cassandra_connector: bool - :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. Possible values include: "Small". - :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer - :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources - (databases, containers, throughput) via account keys. - :vartype disable_key_based_metadata_write_access: bool - :ivar key_vault_key_uri: The URI of the key vault. - :vartype key_vault_key_uri: str - :ivar default_identity: The default identity for accessing key vault used in features like - customer managed keys. The default identity needs to be explicitly set by the users. It can be - "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :vartype default_identity: str - :ivar public_network_access: Whether requests from Public Network are allowed. Possible values - include: "Enabled", "Disabled". - :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess - :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. - :vartype enable_free_tier: bool - :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. - :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties - :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :vartype enable_analytical_storage: bool - :ivar analytical_storage_configuration: Analytical storage specific properties. - :vartype analytical_storage_configuration: - ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration - :ivar backup_policy: The object representing the policy for taking backups on an account. - :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy - :ivar cors: The CORS policy for the Cosmos DB database account. - :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] - :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. - Possible values include: "None", "AzureServices". - :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass - :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl - Bypass for the Cosmos DB account. - :vartype network_acl_bypass_resource_ids: list[str] - :ivar diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :vartype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool - :ivar capacity: The object that represents all properties related to capacity enforcement on an - account. - :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :ivar enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :vartype enable_materialized_views: bool - """ - - _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]'}, - 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, - 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, - 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, - 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, - 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, - 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, - 'key_vault_key_uri': {'key': 'properties.keyVaultKeyUri', 'type': 'str'}, - 'default_identity': {'key': 'properties.defaultIdentity', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, - 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, - 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, - 'analytical_storage_configuration': {'key': 'properties.analyticalStorageConfiguration', 'type': 'AnalyticalStorageConfiguration'}, - '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]'}, - 'diagnostic_log_settings': {'key': 'properties.diagnosticLogSettings', 'type': 'DiagnosticLogSettings'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'capacity': {'key': 'properties.capacity', 'type': 'Capacity'}, - 'enable_materialized_views': {'key': 'properties.enableMaterializedViews', 'type': 'bool'}, - } - - def __init__( - self, - *, - 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, - is_virtual_network_filter_enabled: Optional[bool] = None, - enable_automatic_failover: Optional[bool] = None, - capabilities: Optional[List["Capability"]] = None, - virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, - enable_multiple_write_locations: Optional[bool] = None, - enable_cassandra_connector: Optional[bool] = None, - connector_offer: Optional[Union[str, "ConnectorOffer"]] = None, - disable_key_based_metadata_write_access: Optional[bool] = None, - key_vault_key_uri: Optional[str] = None, - default_identity: Optional[str] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, - enable_free_tier: Optional[bool] = None, - api_properties: Optional["ApiProperties"] = None, - enable_analytical_storage: Optional[bool] = None, - analytical_storage_configuration: Optional["AnalyticalStorageConfiguration"] = 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, - diagnostic_log_settings: Optional["DiagnosticLogSettings"] = None, - disable_local_auth: Optional[bool] = None, - capacity: Optional["Capacity"] = None, - enable_materialized_views: Optional[bool] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword consistency_policy: The consistency policy for the Cosmos DB account. - :paramtype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :keyword locations: An array that contains the georeplication locations enabled for the Cosmos - DB account. - :paramtype locations: list[~azure.mgmt.cosmosdb.models.Location] - :keyword ip_rules: List of IpRules. - :paramtype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] - :keyword is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :paramtype is_virtual_network_filter_enabled: bool - :keyword enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the - account. - :paramtype enable_automatic_failover: bool - :keyword capabilities: List of Cosmos DB capabilities for the account. - :paramtype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :keyword virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB - account. - :paramtype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] - :keyword enable_multiple_write_locations: Enables the account to write in multiple locations. - :paramtype enable_multiple_write_locations: bool - :keyword enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* - account. - :paramtype enable_cassandra_connector: bool - :keyword connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. Possible values include: "Small". - :paramtype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer - :keyword disable_key_based_metadata_write_access: Disable write operations on metadata - resources (databases, containers, throughput) via account keys. - :paramtype disable_key_based_metadata_write_access: bool - :keyword key_vault_key_uri: The URI of the key vault. - :paramtype key_vault_key_uri: str - :keyword default_identity: The default identity for accessing key vault used in features like - customer managed keys. The default identity needs to be explicitly set by the users. It can be - "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :paramtype default_identity: str - :keyword public_network_access: Whether requests from Public Network are allowed. Possible - values include: "Enabled", "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess - :keyword enable_free_tier: Flag to indicate whether Free Tier is enabled. - :paramtype enable_free_tier: bool - :keyword api_properties: API specific properties. Currently, supported only for MongoDB API. - :paramtype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties - :keyword enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :paramtype enable_analytical_storage: bool - :keyword analytical_storage_configuration: Analytical storage specific properties. - :paramtype analytical_storage_configuration: - ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration - :keyword backup_policy: The object representing the policy for taking backups on an account. - :paramtype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy - :keyword cors: The CORS policy for the Cosmos DB database account. - :paramtype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] - :keyword network_acl_bypass: Indicates what services are allowed to bypass firewall checks. - Possible values include: "None", "AzureServices". - :paramtype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass - :keyword network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network - Acl Bypass for the Cosmos DB account. - :paramtype network_acl_bypass_resource_ids: list[str] - :keyword diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :paramtype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings - :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :paramtype disable_local_auth: bool - :keyword capacity: The object that represents all properties related to capacity enforcement on - an account. - :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :keyword enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :paramtype enable_materialized_views: bool - """ - 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 - self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled - self.enable_automatic_failover = enable_automatic_failover - self.capabilities = capabilities - self.virtual_network_rules = virtual_network_rules - self.enable_multiple_write_locations = enable_multiple_write_locations - self.enable_cassandra_connector = enable_cassandra_connector - self.connector_offer = connector_offer - self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access - self.key_vault_key_uri = key_vault_key_uri - self.default_identity = default_identity - self.public_network_access = public_network_access - self.enable_free_tier = enable_free_tier - self.api_properties = api_properties - self.enable_analytical_storage = enable_analytical_storage - self.analytical_storage_configuration = analytical_storage_configuration - 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 - self.diagnostic_log_settings = diagnostic_log_settings - self.disable_local_auth = disable_local_auth - self.capacity = capacity - self.enable_materialized_views = enable_materialized_views - - -class DatabaseRestoreResource(msrest.serialization.Model): - """Specific Databases to restore. - - :ivar database_name: The name of the database available for restore. - :vartype database_name: str - :ivar collection_names: The names of the collections available for restore. - :vartype collection_names: list[str] - """ - - _attribute_map = { - 'database_name': {'key': 'databaseName', 'type': 'str'}, - 'collection_names': {'key': 'collectionNames', 'type': '[str]'}, - } - - def __init__( - self, - *, - database_name: Optional[str] = None, - collection_names: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword database_name: The name of the database available for restore. - :paramtype database_name: str - :keyword collection_names: The names of the collections available for restore. - :paramtype collection_names: list[str] - """ - super(DatabaseRestoreResource, self).__init__(**kwargs) - self.database_name = database_name - self.collection_names = collection_names - - -class DataCenterResource(ARMProxyResource): - """A managed Cassandra data center. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar properties: Properties of a managed Cassandra data center. - :vartype properties: ~azure.mgmt.cosmosdb.models.DataCenterResourceProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DataCenterResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["DataCenterResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of a managed Cassandra data center. - :paramtype properties: ~azure.mgmt.cosmosdb.models.DataCenterResourceProperties - """ - super(DataCenterResource, self).__init__(**kwargs) - self.properties = properties - - -class DataCenterResourceProperties(msrest.serialization.Model): - """Properties of a managed Cassandra data center. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: The status of the resource at the time the operation was called. - Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.cosmosdb.models.ManagedCassandraProvisioningState - :ivar data_center_location: The region this data center should be created in. - :vartype data_center_location: str - :ivar delegated_subnet_id: Resource id of a subnet the nodes in this data center should have - their network interfaces connected to. The subnet must be in the same region specified in - 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's - 'delegatedManagementSubnetId' property. This resource id will be of the form - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/virtualNetworks/:code:``/subnets/:code:``'. - :vartype delegated_subnet_id: str - :ivar node_count: The number of nodes the data center should have. This is the desired number. - After it is set, it may take some time for the data center to be scaled to match. To monitor - the number of nodes and their status, use the fetchNodeStatus method on the cluster. - :vartype node_count: int - :ivar seed_nodes: IP addresses for seed nodes in this data center. This is for reference. - Generally you will want to use the seedNodes property on the cluster, which aggregates the seed - nodes from all data centers in the cluster. - :vartype seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] - :ivar base64_encoded_cassandra_yaml_fragment: A fragment of a cassandra.yaml configuration file - to be included in the cassandra.yaml for all nodes in this data center. The fragment should be - Base64 encoded, and only a subset of keys are allowed. - :vartype base64_encoded_cassandra_yaml_fragment: str - :ivar managed_disk_customer_key_uri: Key uri to use for encryption of managed disks. Ensure the - system assigned identity of the cluster has been assigned appropriate permissions(key - get/wrap/unwrap permissions) on the key. - :vartype managed_disk_customer_key_uri: str - :ivar backup_storage_customer_key_uri: Indicates the Key Uri of the customer key to use for - encryption of the backup storage account. - :vartype backup_storage_customer_key_uri: str - :ivar sku: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. - :vartype sku: str - :ivar disk_sku: Disk SKU used for data centers. Default value is P30. - :vartype disk_sku: str - :ivar disk_capacity: Number of disk used for data centers. Default value is 4. - :vartype disk_capacity: int - :ivar availability_zone: If the data center has Availability Zone feature, apply it to the - Virtual Machine ScaleSet that host the cassandra data center virtual machines. - :vartype availability_zone: bool - :ivar authentication_method_ldap_properties: Ldap authentication method properties. This - feature is in preview. - :vartype authentication_method_ldap_properties: - ~azure.mgmt.cosmosdb.models.AuthenticationMethodLdapProperties - """ - - _validation = { - 'seed_nodes': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'data_center_location': {'key': 'dataCenterLocation', 'type': 'str'}, - 'delegated_subnet_id': {'key': 'delegatedSubnetId', 'type': 'str'}, - 'node_count': {'key': 'nodeCount', 'type': 'int'}, - 'seed_nodes': {'key': 'seedNodes', 'type': '[SeedNode]'}, - 'base64_encoded_cassandra_yaml_fragment': {'key': 'base64EncodedCassandraYamlFragment', 'type': 'str'}, - 'managed_disk_customer_key_uri': {'key': 'managedDiskCustomerKeyUri', 'type': 'str'}, - 'backup_storage_customer_key_uri': {'key': 'backupStorageCustomerKeyUri', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - 'disk_sku': {'key': 'diskSku', 'type': 'str'}, - 'disk_capacity': {'key': 'diskCapacity', 'type': 'int'}, - 'availability_zone': {'key': 'availabilityZone', 'type': 'bool'}, - 'authentication_method_ldap_properties': {'key': 'authenticationMethodLdapProperties', 'type': 'AuthenticationMethodLdapProperties'}, - } - - def __init__( - self, - *, - provisioning_state: Optional[Union[str, "ManagedCassandraProvisioningState"]] = None, - data_center_location: Optional[str] = None, - delegated_subnet_id: Optional[str] = None, - node_count: Optional[int] = None, - base64_encoded_cassandra_yaml_fragment: Optional[str] = None, - managed_disk_customer_key_uri: Optional[str] = None, - backup_storage_customer_key_uri: Optional[str] = None, - sku: Optional[str] = None, - disk_sku: Optional[str] = None, - disk_capacity: Optional[int] = None, - availability_zone: Optional[bool] = None, - authentication_method_ldap_properties: Optional["AuthenticationMethodLdapProperties"] = None, - **kwargs - ): - """ - :keyword provisioning_state: The status of the resource at the time the operation was called. - Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :paramtype provisioning_state: str or - ~azure.mgmt.cosmosdb.models.ManagedCassandraProvisioningState - :keyword data_center_location: The region this data center should be created in. - :paramtype data_center_location: str - :keyword delegated_subnet_id: Resource id of a subnet the nodes in this data center should have - their network interfaces connected to. The subnet must be in the same region specified in - 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's - 'delegatedManagementSubnetId' property. This resource id will be of the form - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/virtualNetworks/:code:``/subnets/:code:``'. - :paramtype delegated_subnet_id: str - :keyword node_count: The number of nodes the data center should have. This is the desired - number. After it is set, it may take some time for the data center to be scaled to match. To - monitor the number of nodes and their status, use the fetchNodeStatus method on the cluster. - :paramtype node_count: int - :keyword base64_encoded_cassandra_yaml_fragment: A fragment of a cassandra.yaml configuration - file to be included in the cassandra.yaml for all nodes in this data center. The fragment - should be Base64 encoded, and only a subset of keys are allowed. - :paramtype base64_encoded_cassandra_yaml_fragment: str - :keyword managed_disk_customer_key_uri: Key uri to use for encryption of managed disks. Ensure - the system assigned identity of the cluster has been assigned appropriate permissions(key - get/wrap/unwrap permissions) on the key. - :paramtype managed_disk_customer_key_uri: str - :keyword backup_storage_customer_key_uri: Indicates the Key Uri of the customer key to use for - encryption of the backup storage account. - :paramtype backup_storage_customer_key_uri: str - :keyword sku: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. - :paramtype sku: str - :keyword disk_sku: Disk SKU used for data centers. Default value is P30. - :paramtype disk_sku: str - :keyword disk_capacity: Number of disk used for data centers. Default value is 4. - :paramtype disk_capacity: int - :keyword availability_zone: If the data center has Availability Zone feature, apply it to the - Virtual Machine ScaleSet that host the cassandra data center virtual machines. - :paramtype availability_zone: bool - :keyword authentication_method_ldap_properties: Ldap authentication method properties. This - feature is in preview. - :paramtype authentication_method_ldap_properties: - ~azure.mgmt.cosmosdb.models.AuthenticationMethodLdapProperties - """ - super(DataCenterResourceProperties, self).__init__(**kwargs) - self.provisioning_state = provisioning_state - self.data_center_location = data_center_location - self.delegated_subnet_id = delegated_subnet_id - self.node_count = node_count - self.seed_nodes = None - self.base64_encoded_cassandra_yaml_fragment = base64_encoded_cassandra_yaml_fragment - self.managed_disk_customer_key_uri = managed_disk_customer_key_uri - self.backup_storage_customer_key_uri = backup_storage_customer_key_uri - self.sku = sku - self.disk_sku = disk_sku - self.disk_capacity = disk_capacity - self.availability_zone = availability_zone - self.authentication_method_ldap_properties = authentication_method_ldap_properties - - -class DataTransferJobFeedResults(msrest.serialization.Model): - """The List operation response, that contains the Data Transfer jobs and their properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Data Transfer jobs and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults] - :ivar next_link: URL to get the next set of Data Transfer job list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataTransferJobGetResults]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DataTransferJobFeedResults, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataTransferJobGetResults(ARMProxyResource): - """A Cosmos DB Data Transfer Job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar job_name: Job Name. - :vartype job_name: str - :ivar source: Source DataStore details. - :vartype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :ivar destination: Destination DataStore details. - :vartype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :ivar status: Job Status. - :vartype status: str - :ivar processed_count: Processed Count. - :vartype processed_count: long - :ivar total_count: Total Count. - :vartype total_count: long - :ivar last_updated_utc_time: Last Updated Time (ISO-8601 format). - :vartype last_updated_utc_time: ~datetime.datetime - :ivar worker_count: Worker count. - :vartype worker_count: int - :ivar error: Error response for Faulted job. - :vartype error: ~azure.mgmt.cosmosdb.models.ErrorResponse - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'job_name': {'readonly': True}, - 'status': {'readonly': True}, - 'processed_count': {'readonly': True}, - 'total_count': {'readonly': True}, - 'last_updated_utc_time': {'readonly': True}, - 'worker_count': {'minimum': 0}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'job_name': {'key': 'properties.jobName', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'DataTransferDataSourceSink'}, - 'destination': {'key': 'properties.destination', 'type': 'DataTransferDataSourceSink'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'processed_count': {'key': 'properties.processedCount', 'type': 'long'}, - 'total_count': {'key': 'properties.totalCount', 'type': 'long'}, - 'last_updated_utc_time': {'key': 'properties.lastUpdatedUtcTime', 'type': 'iso-8601'}, - 'worker_count': {'key': 'properties.workerCount', 'type': 'int'}, - 'error': {'key': 'properties.error', 'type': 'ErrorResponse'}, - } - - def __init__( - self, - *, - source: Optional["DataTransferDataSourceSink"] = None, - destination: Optional["DataTransferDataSourceSink"] = None, - worker_count: Optional[int] = None, - **kwargs - ): - """ - :keyword source: Source DataStore details. - :paramtype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :keyword destination: Destination DataStore details. - :paramtype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :keyword worker_count: Worker count. - :paramtype worker_count: int - """ - super(DataTransferJobGetResults, self).__init__(**kwargs) - self.job_name = None - self.source = source - self.destination = destination - self.status = None - self.processed_count = None - self.total_count = None - self.last_updated_utc_time = None - self.worker_count = worker_count - self.error = None - - -class DataTransferJobProperties(msrest.serialization.Model): - """The properties of a DataTransfer Job. - - 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 job_name: Job Name. - :vartype job_name: str - :ivar source: Required. Source DataStore details. - :vartype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :ivar destination: Required. Destination DataStore details. - :vartype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :ivar status: Job Status. - :vartype status: str - :ivar processed_count: Processed Count. - :vartype processed_count: long - :ivar total_count: Total Count. - :vartype total_count: long - :ivar last_updated_utc_time: Last Updated Time (ISO-8601 format). - :vartype last_updated_utc_time: ~datetime.datetime - :ivar worker_count: Worker count. - :vartype worker_count: int - :ivar error: Error response for Faulted job. - :vartype error: ~azure.mgmt.cosmosdb.models.ErrorResponse - """ - - _validation = { - 'job_name': {'readonly': True}, - 'source': {'required': True}, - 'destination': {'required': True}, - 'status': {'readonly': True}, - 'processed_count': {'readonly': True}, - 'total_count': {'readonly': True}, - 'last_updated_utc_time': {'readonly': True}, - 'worker_count': {'minimum': 0}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'job_name': {'key': 'jobName', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'DataTransferDataSourceSink'}, - 'destination': {'key': 'destination', 'type': 'DataTransferDataSourceSink'}, - 'status': {'key': 'status', 'type': 'str'}, - 'processed_count': {'key': 'processedCount', 'type': 'long'}, - 'total_count': {'key': 'totalCount', 'type': 'long'}, - 'last_updated_utc_time': {'key': 'lastUpdatedUtcTime', 'type': 'iso-8601'}, - 'worker_count': {'key': 'workerCount', 'type': 'int'}, - 'error': {'key': 'error', 'type': 'ErrorResponse'}, - } - - def __init__( - self, - *, - source: "DataTransferDataSourceSink", - destination: "DataTransferDataSourceSink", - worker_count: Optional[int] = None, - **kwargs - ): - """ - :keyword source: Required. Source DataStore details. - :paramtype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :keyword destination: Required. Destination DataStore details. - :paramtype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :keyword worker_count: Worker count. - :paramtype worker_count: int - """ - super(DataTransferJobProperties, self).__init__(**kwargs) - self.job_name = None - self.source = source - self.destination = destination - self.status = None - self.processed_count = None - self.total_count = None - self.last_updated_utc_time = None - self.worker_count = worker_count - self.error = None - - -class RegionalServiceResource(msrest.serialization.Model): - """Resource for a regional service location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The regional service name. - :vartype name: str - :ivar location: The location name. - :vartype location: str - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". - :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RegionalServiceResource, self).__init__(**kwargs) - self.name = None - self.location = None - self.status = None - - -class DataTransferRegionalServiceResource(RegionalServiceResource): - """Resource for a regional service location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The regional service name. - :vartype name: str - :ivar location: The location name. - :vartype location: str - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". - :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DataTransferRegionalServiceResource, self).__init__(**kwargs) - - -class DataTransferServiceResource(msrest.serialization.Model): - """Describes the service response property. - - :ivar properties: Properties for DataTransferServiceResource. - :vartype properties: ~azure.mgmt.cosmosdb.models.DataTransferServiceResourceProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'DataTransferServiceResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["DataTransferServiceResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties for DataTransferServiceResource. - :paramtype properties: ~azure.mgmt.cosmosdb.models.DataTransferServiceResourceProperties - """ - super(DataTransferServiceResource, self).__init__(**kwargs) - self.properties = properties - - -class ServiceResourceProperties(msrest.serialization.Model): - """Services response resource. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DataTransferServiceResourceProperties, GraphAPIComputeServiceResourceProperties, MaterializedViewsBuilderServiceResourceProperties, SqlDedicatedGatewayServiceResourceProperties. - - 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 additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, any] - :ivar creation_time: Time of the last state change (ISO-8601 format). - :vartype creation_time: ~datetime.datetime - :ivar instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", - "Cosmos.D8s", "Cosmos.D16s". - :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar service_type: Required. ServiceType for the service.Constant filled by server. Possible - values include: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", - "MaterializedViewsBuilder". - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". - :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus - """ - - _validation = { - 'creation_time': {'readonly': True}, - 'instance_count': {'minimum': 0}, - 'service_type': {'required': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'instance_size': {'key': 'instanceSize', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - 'service_type': {'key': 'serviceType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - _subtype_map = { - 'service_type': {'DataTransfer': 'DataTransferServiceResourceProperties', 'GraphAPICompute': 'GraphAPIComputeServiceResourceProperties', 'MaterializedViewsBuilder': 'MaterializedViewsBuilderServiceResourceProperties', 'SqlDedicatedGateway': 'SqlDedicatedGatewayServiceResourceProperties'} - } - - def __init__( - self, - *, - additional_properties: Optional[Dict[str, Any]] = None, - instance_size: Optional[Union[str, "ServiceSize"]] = None, - instance_count: Optional[int] = None, - **kwargs - ): - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, any] - :keyword instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", - "Cosmos.D8s", "Cosmos.D16s". - :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize - :keyword instance_count: Instance count for the service. - :paramtype instance_count: int - """ - super(ServiceResourceProperties, self).__init__(**kwargs) - self.additional_properties = additional_properties - self.creation_time = None - self.instance_size = instance_size - self.instance_count = instance_count - self.service_type = 'ServiceResourceProperties' # type: str - self.status = None - - -class DataTransferServiceResourceProperties(ServiceResourceProperties): - """Properties for DataTransferServiceResource. - - 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 additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, any] - :ivar creation_time: Time of the last state change (ISO-8601 format). - :vartype creation_time: ~datetime.datetime - :ivar instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", - "Cosmos.D8s", "Cosmos.D16s". - :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar service_type: Required. ServiceType for the service.Constant filled by server. Possible - values include: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", - "MaterializedViewsBuilder". - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". - :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus - :ivar locations: An array that contains all of the locations for the service. - :vartype locations: list[~azure.mgmt.cosmosdb.models.DataTransferRegionalServiceResource] - """ - - _validation = { - 'creation_time': {'readonly': True}, - 'instance_count': {'minimum': 0}, - 'service_type': {'required': True}, - 'status': {'readonly': True}, - 'locations': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'instance_size': {'key': 'instanceSize', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - 'service_type': {'key': 'serviceType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[DataTransferRegionalServiceResource]'}, - } - - def __init__( - self, - *, - additional_properties: Optional[Dict[str, Any]] = None, - instance_size: Optional[Union[str, "ServiceSize"]] = None, - instance_count: Optional[int] = None, - **kwargs - ): - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, any] - :keyword instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", - "Cosmos.D8s", "Cosmos.D16s". - :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize - :keyword instance_count: Instance count for the service. - :paramtype instance_count: int - """ - super(DataTransferServiceResourceProperties, self).__init__(additional_properties=additional_properties, instance_size=instance_size, instance_count=instance_count, **kwargs) - self.service_type = 'DataTransfer' # type: str - self.locations = None - - -class DiagnosticLogSettings(msrest.serialization.Model): - """Indicates what diagnostic log settings are to be enabled. - - :ivar enable_full_text_query: Describe the level of detail with which queries are to be logged. - Possible values include: "None", "True", "False". - :vartype enable_full_text_query: str or ~azure.mgmt.cosmosdb.models.EnableFullTextQuery - """ - - _attribute_map = { - 'enable_full_text_query': {'key': 'enableFullTextQuery', 'type': 'str'}, - } - - def __init__( - self, - *, - enable_full_text_query: Optional[Union[str, "EnableFullTextQuery"]] = None, - **kwargs - ): - """ - :keyword enable_full_text_query: Describe the level of detail with which queries are to be - logged. Possible values include: "None", "True", "False". - :paramtype enable_full_text_query: str or ~azure.mgmt.cosmosdb.models.EnableFullTextQuery - """ - super(DiagnosticLogSettings, self).__init__(**kwargs) - self.enable_full_text_query = enable_full_text_query - - -class ErrorResponse(msrest.serialization.Model): - """Error Response. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message indicating why the operation failed. - :paramtype message: str - """ - super(ErrorResponse, self).__init__(**kwargs) - self.code = code - self.message = message - - -class ExcludedPath(msrest.serialization.Model): - """ExcludedPath. - - :ivar path: The path for which the indexing behavior applies to. Index paths typically start - with root and end with wildcard (/path/*). - :vartype path: str - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - **kwargs - ): - """ - :keyword path: The path for which the indexing behavior applies to. Index paths typically start - with root and end with wildcard (/path/*). - :paramtype path: str - """ - super(ExcludedPath, self).__init__(**kwargs) - self.path = path - - -class FailoverPolicies(msrest.serialization.Model): - """The list of new failover policies for the failover priority change. - - All required parameters must be populated in order to send to Azure. - - :ivar failover_policies: Required. List of failover policies. - :vartype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] - """ - - _validation = { - 'failover_policies': {'required': True}, - } - - _attribute_map = { - 'failover_policies': {'key': 'failoverPolicies', 'type': '[FailoverPolicy]'}, - } - - def __init__( - self, - *, - failover_policies: List["FailoverPolicy"], - **kwargs - ): - """ - :keyword failover_policies: Required. List of failover policies. - :paramtype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] - """ - super(FailoverPolicies, self).__init__(**kwargs) - self.failover_policies = failover_policies - - -class FailoverPolicy(msrest.serialization.Model): - """The failover policy for a given region of a database account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique identifier of the region in which the database account replicates to. - Example: <accountName>-<locationName>. - :vartype id: str - :ivar location_name: The name of the region in which the database account exists. - :vartype location_name: str - :ivar failover_priority: The failover priority of the region. A failover priority of 0 - indicates a write region. The maximum value for a failover priority = (total number of regions - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :vartype failover_priority: int - """ - - _validation = { - 'id': {'readonly': True}, - 'failover_priority': {'minimum': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'location_name': {'key': 'locationName', 'type': 'str'}, - 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, - } - - def __init__( - self, - *, - location_name: Optional[str] = None, - failover_priority: Optional[int] = None, - **kwargs - ): - """ - :keyword location_name: The name of the region in which the database account exists. - :paramtype location_name: str - :keyword failover_priority: The failover priority of the region. A failover priority of 0 - indicates a write region. The maximum value for a failover priority = (total number of regions - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :paramtype failover_priority: int - """ - super(FailoverPolicy, self).__init__(**kwargs) - self.id = None - self.location_name = location_name - self.failover_priority = failover_priority - - -class GraphAPIComputeRegionalServiceResource(RegionalServiceResource): - """Resource for a regional service location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The regional service name. - :vartype name: str - :ivar location: The location name. - :vartype location: str - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". - :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus - :ivar graph_api_compute_endpoint: The regional endpoint for GraphAPICompute. - :vartype graph_api_compute_endpoint: str - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - 'status': {'readonly': True}, - 'graph_api_compute_endpoint': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'graph_api_compute_endpoint': {'key': 'graphApiComputeEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(GraphAPIComputeRegionalServiceResource, self).__init__(**kwargs) - self.graph_api_compute_endpoint = None - - -class GraphAPIComputeServiceResource(msrest.serialization.Model): - """Describes the service response property for GraphAPICompute. - - :ivar properties: Properties for GraphAPIComputeServiceResource. - :vartype properties: ~azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'GraphAPIComputeServiceResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["GraphAPIComputeServiceResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties for GraphAPIComputeServiceResource. - :paramtype properties: ~azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties - """ - super(GraphAPIComputeServiceResource, self).__init__(**kwargs) - self.properties = properties - - -class GraphAPIComputeServiceResourceProperties(ServiceResourceProperties): - """Properties for GraphAPIComputeServiceResource. - - 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 additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, any] - :ivar creation_time: Time of the last state change (ISO-8601 format). - :vartype creation_time: ~datetime.datetime - :ivar instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", - "Cosmos.D8s", "Cosmos.D16s". - :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar service_type: Required. ServiceType for the service.Constant filled by server. Possible - values include: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", - "MaterializedViewsBuilder". - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". - :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus - :ivar graph_api_compute_endpoint: GraphAPICompute endpoint for the service. - :vartype graph_api_compute_endpoint: str - :ivar locations: An array that contains all of the locations for the service. - :vartype locations: list[~azure.mgmt.cosmosdb.models.GraphAPIComputeRegionalServiceResource] - """ - - _validation = { - 'creation_time': {'readonly': True}, - 'instance_count': {'minimum': 0}, - 'service_type': {'required': True}, - 'status': {'readonly': True}, - 'locations': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'instance_size': {'key': 'instanceSize', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - 'service_type': {'key': 'serviceType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'graph_api_compute_endpoint': {'key': 'graphApiComputeEndpoint', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[GraphAPIComputeRegionalServiceResource]'}, - } - - def __init__( - self, - *, - additional_properties: Optional[Dict[str, Any]] = None, - instance_size: Optional[Union[str, "ServiceSize"]] = None, - instance_count: Optional[int] = None, - graph_api_compute_endpoint: Optional[str] = None, - **kwargs - ): - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, any] - :keyword instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", - "Cosmos.D8s", "Cosmos.D16s". - :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize - :keyword instance_count: Instance count for the service. - :paramtype instance_count: int - :keyword graph_api_compute_endpoint: GraphAPICompute endpoint for the service. - :paramtype graph_api_compute_endpoint: str - """ - super(GraphAPIComputeServiceResourceProperties, self).__init__(additional_properties=additional_properties, instance_size=instance_size, instance_count=instance_count, **kwargs) - self.service_type = 'GraphAPICompute' # type: str - self.graph_api_compute_endpoint = graph_api_compute_endpoint - self.locations = None - - -class GraphResource(msrest.serialization.Model): - """Cosmos DB Graph resource object. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Required. Name of the Cosmos DB Graph. - :vartype id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: str, - **kwargs - ): - """ - :keyword id: Required. Name of the Cosmos DB Graph. - :paramtype id: str - """ - super(GraphResource, self).__init__(**kwargs) - self.id = id - - -class GraphResourceCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Graph resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: Required. The standard JSON format of a Graph resource. - :vartype resource: ~azure.mgmt.cosmosdb.models.GraphResource - :ivar options: A key-value pair of options to be applied for the request. This corresponds to - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'GraphResource'}, - 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, - } - - def __init__( - self, - *, - resource: "GraphResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: Required. The standard JSON format of a Graph resource. - :paramtype resource: ~azure.mgmt.cosmosdb.models.GraphResource - :keyword options: A key-value pair of options to be applied for the request. This corresponds - to the headers sent with the request. - :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions - """ - super(GraphResourceCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options - - -class GraphResourceGetPropertiesOptions(OptionsResource): - """GraphResourceGetPropertiesOptions. - - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - - _attribute_map = { - 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, - } - - def __init__( - self, - *, - throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, - **kwargs - ): - """ - :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :paramtype throughput: int - :keyword autoscale_settings: Specifies the Autoscale settings. - :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - super(GraphResourceGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) - - -class GraphResourceGetPropertiesResource(GraphResource): - """GraphResourceGetPropertiesResource. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Required. Name of the Cosmos DB Graph. - :vartype id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: str, - **kwargs - ): - """ - :keyword id: Required. Name of the Cosmos DB Graph. - :paramtype id: str - """ - super(GraphResourceGetPropertiesResource, self).__init__(id=id, **kwargs) - - -class GraphResourceGetResults(ARMResourceProperties): - """An Azure Cosmos DB Graph resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesOptions - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'GraphResourceGetPropertiesResource'}, - 'options': {'key': 'properties.options', 'type': 'GraphResourceGetPropertiesOptions'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["GraphResourceGetPropertiesResource"] = None, - options: Optional["GraphResourceGetPropertiesOptions"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesOptions - """ - super(GraphResourceGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options - - -class GraphResourcesListResult(msrest.serialization.Model): - """The List operation response, that contains the Graph resource and their properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Graph resource and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GraphResourceGetResults]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(GraphResourcesListResult, self).__init__(**kwargs) - self.value = None - - -class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Gremlin database. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: Required. The standard JSON format of a Gremlin database. - :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource - :ivar options: A key-value pair of options to be applied for the request. This corresponds to - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, - 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, - } - - def __init__( - self, - *, - resource: "GremlinDatabaseResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: Required. The standard JSON format of a Gremlin database. - :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource - :keyword options: A key-value pair of options to be applied for the request. This corresponds - to the headers sent with the request. - :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions - """ - super(GremlinDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options - - -class GremlinDatabaseGetPropertiesOptions(OptionsResource): - """GremlinDatabaseGetPropertiesOptions. - - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - - _attribute_map = { - 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, - } - - def __init__( - self, - *, - throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, - **kwargs - ): - """ - :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :paramtype throughput: int - :keyword autoscale_settings: Specifies the Autoscale settings. - :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - super(GremlinDatabaseGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) - - -class GremlinDatabaseResource(msrest.serialization.Model): - """Cosmos DB Gremlin database resource object. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Required. Name of the Cosmos DB Gremlin database. - :vartype id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: str, - **kwargs - ): - """ - :keyword id: Required. Name of the Cosmos DB Gremlin database. - :paramtype id: str - """ - super(GremlinDatabaseResource, self).__init__(**kwargs) - self.id = id - - -class GremlinDatabaseGetPropertiesResource(ExtendedResourceProperties, GremlinDatabaseResource): - """GremlinDatabaseGetPropertiesResource. - - 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: Required. Name of the Cosmos DB Gremlin database. - :vartype id: str - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str - """ - - _validation = { - 'id': {'required': True}, - 'rid': {'readonly': True}, - 'ts': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'float'}, - 'etag': {'key': '_etag', 'type': 'str'}, - } - - def __init__( - self, - *, - id: str, - **kwargs - ): - """ - :keyword id: Required. Name of the Cosmos DB Gremlin database. - :paramtype id: str - """ - super(GremlinDatabaseGetPropertiesResource, self).__init__(id=id, **kwargs) - self.id = id - self.rid = None - self.ts = None - self.etag = None - - -class GremlinDatabaseGetResults(ARMResourceProperties): - """An Azure Cosmos DB Gremlin database. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[IpAddressOrRange]'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + 'key_vault_key_uri': {'key': 'properties.keyVaultKeyUri', 'type': 'str'}, + 'default_identity': {'key': 'properties.defaultIdentity', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, + 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, + 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, + 'analytical_storage_configuration': {'key': 'properties.analyticalStorageConfiguration', 'type': 'AnalyticalStorageConfiguration'}, + 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, + '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]'}, + 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + 'restore_parameters': {'key': 'properties.restoreParameters', 'type': 'RestoreParameters'}, + 'capacity': {'key': 'properties.capacity', 'type': 'Capacity'}, } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseGetPropertiesResource'}, - 'options': {'key': 'properties.options', 'type': 'GremlinDatabaseGetPropertiesOptions'}, - } + database_account_offer_type = "Standard" def __init__( self, *, + locations: List["_models.Location"], location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["GremlinDatabaseGetPropertiesResource"] = None, - options: Optional["GremlinDatabaseGetPropertiesOptions"] = None, + kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + consistency_policy: Optional["_models.ConsistencyPolicy"] = None, + ip_rules: Optional[List["_models.IpAddressOrRange"]] = None, + is_virtual_network_filter_enabled: Optional[bool] = None, + enable_automatic_failover: Optional[bool] = None, + capabilities: Optional[List["_models.Capability"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, + enable_multiple_write_locations: Optional[bool] = None, + enable_cassandra_connector: Optional[bool] = None, + connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = None, + disable_key_based_metadata_write_access: Optional[bool] = None, + key_vault_key_uri: Optional[str] = None, + default_identity: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + enable_free_tier: Optional[bool] = None, + api_properties: Optional["_models.ApiProperties"] = None, + enable_analytical_storage: Optional[bool] = None, + analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = "Default", + backup_policy: Optional["_models.BackupPolicy"] = None, + cors: Optional[List["_models.CorsPolicy"]] = None, + network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, + network_acl_bypass_resource_ids: Optional[List[str]] = None, + disable_local_auth: Optional[bool] = None, + restore_parameters: Optional["_models.RestoreParameters"] = None, + capacity: Optional["_models.Capacity"] = None, **kwargs ): """ @@ -6116,84 +2634,118 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] + :keyword kind: Indicates the type of database account. This can only be set at database account + creation. Known values are: "GlobalDocumentDB", "MongoDB", "Parse". + :paramtype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind :keyword identity: Identity for the resource. :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions - """ - super(GremlinDatabaseGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options - - -class GremlinDatabaseListResult(msrest.serialization.Model): - """The List operation response, that contains the Gremlin databases and their properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Gremlin databases and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GremlinDatabaseGetResults]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(GremlinDatabaseListResult, self).__init__(**kwargs) - self.value = None - - -class GremlinDatabaseRestoreResource(msrest.serialization.Model): - """Specific Gremlin Databases to restore. - - :ivar database_name: The name of the gremlin database available for restore. - :vartype database_name: str - :ivar graph_names: The names of the graphs available for restore. - :vartype graph_names: list[str] - """ - - _attribute_map = { - 'database_name': {'key': 'databaseName', 'type': 'str'}, - 'graph_names': {'key': 'graphNames', 'type': '[str]'}, - } - - def __init__( - self, - *, - database_name: Optional[str] = None, - graph_names: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword database_name: The name of the gremlin database available for restore. - :paramtype database_name: str - :keyword graph_names: The names of the graphs available for restore. - :paramtype graph_names: list[str] + :keyword consistency_policy: The consistency policy for the Cosmos DB account. + :paramtype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :keyword locations: Required. An array that contains the georeplication locations enabled for + the Cosmos DB account. + :paramtype locations: list[~azure.mgmt.cosmosdb.models.Location] + :keyword ip_rules: List of IpRules. + :paramtype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] + :keyword is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual + Network ACL rules. + :paramtype is_virtual_network_filter_enabled: bool + :keyword enable_automatic_failover: Enables automatic failover of the write region in the rare + event that the region is unavailable due to an outage. Automatic failover will result in a new + write region for the account and is chosen based on the failover priorities configured for the + account. + :paramtype enable_automatic_failover: bool + :keyword capabilities: List of Cosmos DB capabilities for the account. + :paramtype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :keyword virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + account. + :paramtype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] + :keyword enable_multiple_write_locations: Enables the account to write in multiple locations. + :paramtype enable_multiple_write_locations: bool + :keyword enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* + account. + :paramtype enable_cassandra_connector: bool + :keyword connector_offer: The cassandra connector offer type for the Cosmos DB database C* + account. Known values are: "Small". + :paramtype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer + :keyword disable_key_based_metadata_write_access: Disable write operations on metadata + resources (databases, containers, throughput) via account keys. + :paramtype disable_key_based_metadata_write_access: bool + :keyword key_vault_key_uri: The URI of the key vault. + :paramtype key_vault_key_uri: str + :keyword default_identity: The default identity for accessing key vault used in features like + customer managed keys. The default identity needs to be explicitly set by the users. It can be + "FirstPartyIdentity", "SystemAssignedIdentity" and more. + :paramtype default_identity: str + :keyword public_network_access: Whether requests from Public Network are allowed. Known values + are: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess + :keyword enable_free_tier: Flag to indicate whether Free Tier is enabled. + :paramtype enable_free_tier: bool + :keyword api_properties: API specific properties. Currently, supported only for MongoDB API. + :paramtype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties + :keyword enable_analytical_storage: Flag to indicate whether to enable storage analytics. + :paramtype enable_analytical_storage: bool + :keyword analytical_storage_configuration: Analytical storage specific properties. + :paramtype analytical_storage_configuration: + ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration + :keyword create_mode: Enum to indicate the mode of account creation. Known values are: + "Default", "Restore". Default value: "Default". + :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword backup_policy: The object representing the policy for taking backups on an account. + :paramtype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy + :keyword cors: The CORS policy for the Cosmos DB database account. + :paramtype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :keyword network_acl_bypass: Indicates what services are allowed to bypass firewall checks. + Known values are: "None", "AzureServices". + :paramtype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :keyword network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network + Acl Bypass for the Cosmos DB account. + :paramtype network_acl_bypass_resource_ids: list[str] + :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :paramtype disable_local_auth: bool + :keyword restore_parameters: Parameters to indicate the information about the restore. + :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters + :keyword capacity: The object that represents all properties related to capacity enforcement on + an account. + :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity """ - super(GremlinDatabaseRestoreResource, self).__init__(**kwargs) - self.database_name = database_name - self.graph_names = graph_names + 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 + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.capabilities = capabilities + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access + self.key_vault_key_uri = key_vault_key_uri + self.default_identity = default_identity + self.public_network_access = public_network_access + self.enable_free_tier = enable_free_tier + self.api_properties = api_properties + self.enable_analytical_storage = enable_analytical_storage + self.analytical_storage_configuration = analytical_storage_configuration + self.create_mode = create_mode + 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 + self.disable_local_auth = disable_local_auth + self.restore_parameters = restore_parameters + self.capacity = capacity -class GremlinGraphCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Gremlin graph. +class DatabaseAccountGetResults(ARMResourceProperties): + """An Azure Cosmos DB database account. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the ARM resource. :vartype id: str :ivar name: The name of the ARM resource. @@ -6209,20 +2761,125 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] + :ivar kind: Indicates the type of database account. This can only be set at database account + creation. Known values are: "GlobalDocumentDB", "MongoDB", "Parse". + :vartype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind :ivar identity: Identity for the resource. :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: Required. The standard JSON format of a Gremlin graph. - :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphResource - :ivar options: A key-value pair of options to be applied for the request. This corresponds to - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :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 + the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is + active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB + account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – + the Cosmos DB account deletion failed. + :vartype provisioning_state: str + :ivar document_endpoint: The connection endpoint for the Cosmos DB database account. + :vartype document_endpoint: str + :ivar database_account_offer_type: The offer type for the Cosmos DB database account. Default + value: Standard. The only acceptable values to pass in are None and "Standard". The default + value is None. + :vartype database_account_offer_type: str + :ivar ip_rules: List of IpRules. + :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] + :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual + Network ACL rules. + :vartype is_virtual_network_filter_enabled: bool + :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare + event that the region is unavailable due to an outage. Automatic failover will result in a new + write region for the account and is chosen based on the failover priorities configured for the + account. + :vartype enable_automatic_failover: bool + :ivar consistency_policy: The consistency policy for the Cosmos DB database account. + :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :ivar capabilities: List of Cosmos DB capabilities for the account. + :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :ivar write_locations: An array that contains the write location for the Cosmos DB account. + :vartype write_locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar read_locations: An array that contains of the read locations enabled for the Cosmos DB + account. + :vartype read_locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar locations: An array that contains all of the locations enabled for the Cosmos DB account. + :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar failover_policies: An array that contains the regions ordered by their failover + priorities. + :vartype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] + :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + account. + :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] + :ivar private_endpoint_connections: List of Private Endpoint Connections configured for the + Cosmos DB account. + :vartype private_endpoint_connections: + list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. + :vartype enable_multiple_write_locations: bool + :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. + :vartype enable_cassandra_connector: bool + :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* + account. Known values are: "Small". + :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer + :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources + (databases, containers, throughput) via account keys. + :vartype disable_key_based_metadata_write_access: bool + :ivar key_vault_key_uri: The URI of the key vault. + :vartype key_vault_key_uri: str + :ivar default_identity: The default identity for accessing key vault used in features like + customer managed keys. The default identity needs to be explicitly set by the users. It can be + "FirstPartyIdentity", "SystemAssignedIdentity" and more. + :vartype default_identity: str + :ivar public_network_access: Whether requests from Public Network are allowed. Known values + are: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess + :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. + :vartype enable_free_tier: bool + :ivar api_properties: API specific properties. + :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties + :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. + :vartype enable_analytical_storage: bool + :ivar analytical_storage_configuration: Analytical storage specific properties. + :vartype analytical_storage_configuration: + ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration + :ivar instance_id: A unique identifier assigned to the database account. + :vartype instance_id: str + :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default", + "Restore". Default value: "Default". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters + :ivar backup_policy: The object representing the policy for taking backups on an account. + :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy + :ivar cors: The CORS policy for the Cosmos DB database account. + :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known + values are: "None", "AzureServices". + :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :vartype network_acl_bypass_resource_ids: list[str] + :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :vartype disable_local_auth: bool + :ivar capacity: The object that represents all properties related to capacity enforcement on an + account. + :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'database_account_offer_type': {'readonly': True}, + 'write_locations': {'readonly': True}, + 'read_locations': {'readonly': True}, + 'locations': {'readonly': True}, + 'failover_policies': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'instance_id': {'readonly': True}, } _attribute_map = { @@ -6231,19 +2888,77 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphResource'}, - 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[IpAddressOrRange]'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'}, + 'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + 'key_vault_key_uri': {'key': 'properties.keyVaultKeyUri', 'type': 'str'}, + 'default_identity': {'key': 'properties.defaultIdentity', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, + 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, + 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, + 'analytical_storage_configuration': {'key': 'properties.analyticalStorageConfiguration', 'type': 'AnalyticalStorageConfiguration'}, + 'instance_id': {'key': 'properties.instanceId', 'type': 'str'}, + 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, + 'restore_parameters': {'key': 'properties.restoreParameters', 'type': 'RestoreParameters'}, + '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]'}, + 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + 'capacity': {'key': 'properties.capacity', 'type': 'Capacity'}, } def __init__( self, *, - resource: "GremlinGraphResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + ip_rules: Optional[List["_models.IpAddressOrRange"]] = None, + is_virtual_network_filter_enabled: Optional[bool] = None, + enable_automatic_failover: Optional[bool] = None, + consistency_policy: Optional["_models.ConsistencyPolicy"] = None, + capabilities: Optional[List["_models.Capability"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, + enable_multiple_write_locations: Optional[bool] = None, + enable_cassandra_connector: Optional[bool] = None, + connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = None, + disable_key_based_metadata_write_access: Optional[bool] = None, + key_vault_key_uri: Optional[str] = None, + default_identity: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + enable_free_tier: Optional[bool] = None, + api_properties: Optional["_models.ApiProperties"] = None, + enable_analytical_storage: Optional[bool] = None, + analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = "Default", + restore_parameters: Optional["_models.RestoreParameters"] = None, + backup_policy: Optional["_models.BackupPolicy"] = None, + cors: Optional[List["_models.CorsPolicy"]] = None, + network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, + network_acl_bypass_resource_ids: Optional[List[str]] = None, + disable_local_auth: Optional[bool] = None, + capacity: Optional["_models.Capacity"] = None, **kwargs ): """ @@ -6256,305 +2971,206 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] + :keyword kind: Indicates the type of database account. This can only be set at database account + creation. Known values are: "GlobalDocumentDB", "MongoDB", "Parse". + :paramtype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind :keyword identity: Identity for the resource. :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: Required. The standard JSON format of a Gremlin graph. - :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphResource - :keyword options: A key-value pair of options to be applied for the request. This corresponds - to the headers sent with the request. - :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions - """ - super(GremlinGraphCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options - - -class GremlinGraphGetPropertiesOptions(OptionsResource): - """GremlinGraphGetPropertiesOptions. - - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - - _attribute_map = { - 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, - } - - def __init__( - self, - *, - throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, - **kwargs - ): - """ - :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :paramtype throughput: int - :keyword autoscale_settings: Specifies the Autoscale settings. - :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - super(GremlinGraphGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) - - -class GremlinGraphResource(msrest.serialization.Model): - """Cosmos DB Gremlin graph resource object. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Required. Name of the Cosmos DB Gremlin graph. - :vartype id: str - :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the graph. - :vartype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy - :ivar partition_key: The configuration of the partition key to be used for partitioning data - into multiple partitions. - :vartype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey - :ivar default_ttl: Default time to live. - :vartype default_ttl: int - :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness - constraints on documents in the collection in the Azure Cosmos DB service. - :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy - :ivar conflict_resolution_policy: The conflict resolution policy for the graph. - :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, - 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, - 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, - 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, - 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, - } - - def __init__( - self, - *, - id: str, - indexing_policy: Optional["IndexingPolicy"] = None, - partition_key: Optional["ContainerPartitionKey"] = None, - default_ttl: Optional[int] = None, - unique_key_policy: Optional["UniqueKeyPolicy"] = None, - conflict_resolution_policy: Optional["ConflictResolutionPolicy"] = None, - **kwargs - ): - """ - :keyword id: Required. Name of the Cosmos DB Gremlin graph. - :paramtype id: str - :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the graph. - :paramtype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy - :keyword partition_key: The configuration of the partition key to be used for partitioning data - into multiple partitions. - :paramtype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey - :keyword default_ttl: Default time to live. - :paramtype default_ttl: int - :keyword unique_key_policy: The unique key policy configuration for specifying uniqueness - constraints on documents in the collection in the Azure Cosmos DB service. - :paramtype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy - :keyword conflict_resolution_policy: The conflict resolution policy for the graph. - :paramtype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :keyword ip_rules: List of IpRules. + :paramtype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] + :keyword is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual + Network ACL rules. + :paramtype is_virtual_network_filter_enabled: bool + :keyword enable_automatic_failover: Enables automatic failover of the write region in the rare + event that the region is unavailable due to an outage. Automatic failover will result in a new + write region for the account and is chosen based on the failover priorities configured for the + account. + :paramtype enable_automatic_failover: bool + :keyword consistency_policy: The consistency policy for the Cosmos DB database account. + :paramtype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :keyword capabilities: List of Cosmos DB capabilities for the account. + :paramtype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :keyword virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + account. + :paramtype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] + :keyword enable_multiple_write_locations: Enables the account to write in multiple locations. + :paramtype enable_multiple_write_locations: bool + :keyword enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* + account. + :paramtype enable_cassandra_connector: bool + :keyword connector_offer: The cassandra connector offer type for the Cosmos DB database C* + account. Known values are: "Small". + :paramtype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer + :keyword disable_key_based_metadata_write_access: Disable write operations on metadata + resources (databases, containers, throughput) via account keys. + :paramtype disable_key_based_metadata_write_access: bool + :keyword key_vault_key_uri: The URI of the key vault. + :paramtype key_vault_key_uri: str + :keyword default_identity: The default identity for accessing key vault used in features like + customer managed keys. The default identity needs to be explicitly set by the users. It can be + "FirstPartyIdentity", "SystemAssignedIdentity" and more. + :paramtype default_identity: str + :keyword public_network_access: Whether requests from Public Network are allowed. Known values + are: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess + :keyword enable_free_tier: Flag to indicate whether Free Tier is enabled. + :paramtype enable_free_tier: bool + :keyword api_properties: API specific properties. + :paramtype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties + :keyword enable_analytical_storage: Flag to indicate whether to enable storage analytics. + :paramtype enable_analytical_storage: bool + :keyword analytical_storage_configuration: Analytical storage specific properties. + :paramtype analytical_storage_configuration: + ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration + :keyword create_mode: Enum to indicate the mode of account creation. Known values are: + "Default", "Restore". Default value: "Default". + :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword restore_parameters: Parameters to indicate the information about the restore. + :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters + :keyword backup_policy: The object representing the policy for taking backups on an account. + :paramtype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy + :keyword cors: The CORS policy for the Cosmos DB database account. + :paramtype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :keyword network_acl_bypass: Indicates what services are allowed to bypass firewall checks. + Known values are: "None", "AzureServices". + :paramtype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :keyword network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network + Acl Bypass for the Cosmos DB account. + :paramtype network_acl_bypass_resource_ids: list[str] + :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :paramtype disable_local_auth: bool + :keyword capacity: The object that represents all properties related to capacity enforcement on + an account. + :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity """ - super(GremlinGraphResource, self).__init__(**kwargs) - self.id = id - self.indexing_policy = indexing_policy - self.partition_key = partition_key - self.default_ttl = default_ttl - self.unique_key_policy = unique_key_policy - self.conflict_resolution_policy = conflict_resolution_policy - - -class GremlinGraphGetPropertiesResource(ExtendedResourceProperties, GremlinGraphResource): - """GremlinGraphGetPropertiesResource. + super(DatabaseAccountGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.identity = identity + self.system_data = None + self.provisioning_state = None + self.document_endpoint = None + self.database_account_offer_type = None + self.ip_rules = ip_rules + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.consistency_policy = consistency_policy + self.capabilities = capabilities + self.write_locations = None + self.read_locations = None + self.locations = None + self.failover_policies = None + self.virtual_network_rules = virtual_network_rules + self.private_endpoint_connections = None + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access + self.key_vault_key_uri = key_vault_key_uri + self.default_identity = default_identity + self.public_network_access = public_network_access + self.enable_free_tier = enable_free_tier + self.api_properties = api_properties + self.enable_analytical_storage = enable_analytical_storage + self.analytical_storage_configuration = analytical_storage_configuration + self.instance_id = None + self.create_mode = create_mode + self.restore_parameters = restore_parameters + 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 + self.disable_local_auth = disable_local_auth + self.capacity = capacity - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class DatabaseAccountListConnectionStringsResult(msrest.serialization.Model): + """The connection strings for the given database account. - :ivar id: Required. Name of the Cosmos DB Gremlin graph. - :vartype id: str - :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the graph. - :vartype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy - :ivar partition_key: The configuration of the partition key to be used for partitioning data - into multiple partitions. - :vartype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey - :ivar default_ttl: Default time to live. - :vartype default_ttl: int - :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness - constraints on documents in the collection in the Azure Cosmos DB service. - :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy - :ivar conflict_resolution_policy: The conflict resolution policy for the graph. - :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str + :ivar connection_strings: An array that contains the connection strings for the Cosmos DB + account. + :vartype connection_strings: list[~azure.mgmt.cosmosdb.models.DatabaseAccountConnectionString] """ - _validation = { - 'id': {'required': True}, - 'rid': {'readonly': True}, - 'ts': {'readonly': True}, - 'etag': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, - 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, - 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, - 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, - 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, - 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'float'}, - 'etag': {'key': '_etag', 'type': 'str'}, + 'connection_strings': {'key': 'connectionStrings', 'type': '[DatabaseAccountConnectionString]'}, } def __init__( self, *, - id: str, - indexing_policy: Optional["IndexingPolicy"] = None, - partition_key: Optional["ContainerPartitionKey"] = None, - default_ttl: Optional[int] = None, - unique_key_policy: Optional["UniqueKeyPolicy"] = None, - conflict_resolution_policy: Optional["ConflictResolutionPolicy"] = None, + connection_strings: Optional[List["_models.DatabaseAccountConnectionString"]] = None, **kwargs ): """ - :keyword id: Required. Name of the Cosmos DB Gremlin graph. - :paramtype id: str - :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the graph. - :paramtype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy - :keyword partition_key: The configuration of the partition key to be used for partitioning data - into multiple partitions. - :paramtype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey - :keyword default_ttl: Default time to live. - :paramtype default_ttl: int - :keyword unique_key_policy: The unique key policy configuration for specifying uniqueness - constraints on documents in the collection in the Azure Cosmos DB service. - :paramtype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy - :keyword conflict_resolution_policy: The conflict resolution policy for the graph. - :paramtype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :keyword connection_strings: An array that contains the connection strings for the Cosmos DB + account. + :paramtype connection_strings: + list[~azure.mgmt.cosmosdb.models.DatabaseAccountConnectionString] """ - super(GremlinGraphGetPropertiesResource, self).__init__(id=id, indexing_policy=indexing_policy, partition_key=partition_key, default_ttl=default_ttl, unique_key_policy=unique_key_policy, conflict_resolution_policy=conflict_resolution_policy, **kwargs) - self.id = id - self.indexing_policy = indexing_policy - self.partition_key = partition_key - self.default_ttl = default_ttl - self.unique_key_policy = unique_key_policy - self.conflict_resolution_policy = conflict_resolution_policy - self.rid = None - self.ts = None - self.etag = None + super(DatabaseAccountListConnectionStringsResult, self).__init__(**kwargs) + self.connection_strings = connection_strings -class GremlinGraphGetResults(ARMResourceProperties): - """An Azure Cosmos DB Gremlin graph. +class DatabaseAccountListReadOnlyKeysResult(msrest.serialization.Model): + """The read-only access keys for the given database account. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesOptions + :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. + :vartype secondary_readonly_master_key: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphGetPropertiesResource'}, - 'options': {'key': 'properties.options', 'type': 'GremlinGraphGetPropertiesOptions'}, + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, } def __init__( self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["GremlinGraphGetPropertiesResource"] = None, - options: Optional["GremlinGraphGetPropertiesOptions"] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesOptions """ - super(GremlinGraphGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options + super(DatabaseAccountListReadOnlyKeysResult, self).__init__(**kwargs) + self.primary_readonly_master_key = None + self.secondary_readonly_master_key = None -class GremlinGraphListResult(msrest.serialization.Model): - """The List operation response, that contains the graphs and their properties. +class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): + """The access keys for the given database account. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of graphs and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. + :vartype secondary_readonly_master_key: str + :ivar primary_master_key: Base 64 encoded value of the primary read-write key. + :vartype primary_master_key: str + :ivar secondary_master_key: Base 64 encoded value of the secondary read-write key. + :vartype secondary_master_key: str """ _validation = { - 'value': {'readonly': True}, + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + 'primary_master_key': {'readonly': True}, + 'secondary_master_key': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[GremlinGraphGetResults]'}, + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + 'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'}, + 'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'}, } def __init__( @@ -6563,296 +3179,558 @@ def __init__( ): """ """ - super(GremlinGraphListResult, self).__init__(**kwargs) - self.value = None + super(DatabaseAccountListKeysResult, self).__init__(**kwargs) + self.primary_master_key = None + self.secondary_master_key = None -class IncludedPath(msrest.serialization.Model): - """The paths that are included in indexing. +class DatabaseAccountRegenerateKeyParameters(msrest.serialization.Model): + """Parameters to regenerate the keys within the database account. - :ivar path: The path for which the indexing behavior applies to. Index paths typically start - with root and end with wildcard (/path/*). - :vartype path: str - :ivar indexes: List of indexes for this path. - :vartype indexes: list[~azure.mgmt.cosmosdb.models.Indexes] + All required parameters must be populated in order to send to Azure. + + :ivar key_kind: Required. The access key to regenerate. Known values are: "primary", + "secondary", "primaryReadonly", "secondaryReadonly". + :vartype key_kind: str or ~azure.mgmt.cosmosdb.models.KeyKind """ + _validation = { + 'key_kind': {'required': True}, + } + _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, + 'key_kind': {'key': 'keyKind', 'type': 'str'}, } def __init__( self, *, - path: Optional[str] = None, - indexes: Optional[List["Indexes"]] = None, + key_kind: Union[str, "_models.KeyKind"], **kwargs ): """ - :keyword path: The path for which the indexing behavior applies to. Index paths typically start - with root and end with wildcard (/path/*). - :paramtype path: str - :keyword indexes: List of indexes for this path. - :paramtype indexes: list[~azure.mgmt.cosmosdb.models.Indexes] + :keyword key_kind: Required. The access key to regenerate. Known values are: "primary", + "secondary", "primaryReadonly", "secondaryReadonly". + :paramtype key_kind: str or ~azure.mgmt.cosmosdb.models.KeyKind """ - super(IncludedPath, self).__init__(**kwargs) - self.path = path - self.indexes = indexes + super(DatabaseAccountRegenerateKeyParameters, self).__init__(**kwargs) + self.key_kind = key_kind -class Indexes(msrest.serialization.Model): - """The indexes for the path. +class DatabaseAccountsListResult(msrest.serialization.Model): + """The List operation response, that contains the database accounts and their properties. - :ivar data_type: The datatype for which the indexing behavior is applied to. Possible values - include: "String", "Number", "Point", "Polygon", "LineString", "MultiPolygon". Default value: - "String". - :vartype data_type: str or ~azure.mgmt.cosmosdb.models.DataType - :ivar precision: The precision of the index. -1 is maximum precision. - :vartype precision: int - :ivar kind: Indicates the type of index. Possible values include: "Hash", "Range", "Spatial". - Default value: "Hash". - :vartype kind: str or ~azure.mgmt.cosmosdb.models.IndexKind + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of database account and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] """ + _validation = { + 'value': {'readonly': True}, + } + _attribute_map = { - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'precision': {'key': 'precision', 'type': 'int'}, - 'kind': {'key': 'kind', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DatabaseAccountGetResults]'}, } def __init__( self, - *, - data_type: Optional[Union[str, "DataType"]] = "String", - precision: Optional[int] = None, - kind: Optional[Union[str, "IndexKind"]] = "Hash", **kwargs ): """ - :keyword data_type: The datatype for which the indexing behavior is applied to. Possible values - include: "String", "Number", "Point", "Polygon", "LineString", "MultiPolygon". Default value: - "String". - :paramtype data_type: str or ~azure.mgmt.cosmosdb.models.DataType - :keyword precision: The precision of the index. -1 is maximum precision. - :paramtype precision: int - :keyword kind: Indicates the type of index. Possible values include: "Hash", "Range", - "Spatial". Default value: "Hash". - :paramtype kind: str or ~azure.mgmt.cosmosdb.models.IndexKind - """ - super(Indexes, self).__init__(**kwargs) - self.data_type = data_type - self.precision = precision - self.kind = kind + """ + super(DatabaseAccountsListResult, self).__init__(**kwargs) + self.value = None -class IndexingPolicy(msrest.serialization.Model): - """Cosmos DB indexing policy. +class DatabaseAccountUpdateParameters(msrest.serialization.Model): + """Parameters for patching Azure Cosmos DB database account properties. - :ivar automatic: Indicates if the indexing policy is automatic. - :vartype automatic: bool - :ivar indexing_mode: Indicates the indexing mode. Possible values include: "consistent", - "lazy", "none". Default value: "consistent". - :vartype indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode - :ivar included_paths: List of paths to include in the indexing. - :vartype included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] - :ivar excluded_paths: List of paths to exclude from indexing. - :vartype excluded_paths: list[~azure.mgmt.cosmosdb.models.ExcludedPath] - :ivar composite_indexes: List of composite path list. - :vartype composite_indexes: list[list[~azure.mgmt.cosmosdb.models.CompositePath]] - :ivar spatial_indexes: List of spatial specifics. - :vartype spatial_indexes: list[~azure.mgmt.cosmosdb.models.SpatialSpec] + :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These + tags can be used in viewing and grouping this resource (across resource groups). A maximum of + 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters + and value no greater than 256 characters. For example, the default experience for a template + type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also + include "Table", "Graph", "DocumentDB", and "MongoDB". + :vartype tags: dict[str, str] + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :ivar consistency_policy: The consistency policy for the Cosmos DB account. + :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB + account. + :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar ip_rules: List of IpRules. + :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] + :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual + Network ACL rules. + :vartype is_virtual_network_filter_enabled: bool + :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare + event that the region is unavailable due to an outage. Automatic failover will result in a new + write region for the account and is chosen based on the failover priorities configured for the + account. + :vartype enable_automatic_failover: bool + :ivar capabilities: List of Cosmos DB capabilities for the account. + :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + account. + :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] + :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. + :vartype enable_multiple_write_locations: bool + :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. + :vartype enable_cassandra_connector: bool + :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* + account. Known values are: "Small". + :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer + :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources + (databases, containers, throughput) via account keys. + :vartype disable_key_based_metadata_write_access: bool + :ivar key_vault_key_uri: The URI of the key vault. + :vartype key_vault_key_uri: str + :ivar default_identity: The default identity for accessing key vault used in features like + customer managed keys. The default identity needs to be explicitly set by the users. It can be + "FirstPartyIdentity", "SystemAssignedIdentity" and more. + :vartype default_identity: str + :ivar public_network_access: Whether requests from Public Network are allowed. Known values + are: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess + :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. + :vartype enable_free_tier: bool + :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. + :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties + :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. + :vartype enable_analytical_storage: bool + :ivar analytical_storage_configuration: Analytical storage specific properties. + :vartype analytical_storage_configuration: + ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration + :ivar backup_policy: The object representing the policy for taking backups on an account. + :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy + :ivar cors: The CORS policy for the Cosmos DB database account. + :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known + values are: "None", "AzureServices". + :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :vartype network_acl_bypass_resource_ids: list[str] + :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :vartype disable_local_auth: bool + :ivar capacity: The object that represents all properties related to capacity enforcement on an + account. + :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity """ _attribute_map = { - 'automatic': {'key': 'automatic', 'type': 'bool'}, - 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, - 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, - 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, - 'composite_indexes': {'key': 'compositeIndexes', 'type': '[[CompositePath]]'}, - 'spatial_indexes': {'key': 'spatialIndexes', 'type': '[SpatialSpec]'}, + '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]'}, + 'is_virtual_network_filter_enabled': {'key': 'properties.isVirtualNetworkFilterEnabled', 'type': 'bool'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'capabilities': {'key': 'properties.capabilities', 'type': '[Capability]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, + 'enable_cassandra_connector': {'key': 'properties.enableCassandraConnector', 'type': 'bool'}, + 'connector_offer': {'key': 'properties.connectorOffer', 'type': 'str'}, + 'disable_key_based_metadata_write_access': {'key': 'properties.disableKeyBasedMetadataWriteAccess', 'type': 'bool'}, + 'key_vault_key_uri': {'key': 'properties.keyVaultKeyUri', 'type': 'str'}, + 'default_identity': {'key': 'properties.defaultIdentity', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'enable_free_tier': {'key': 'properties.enableFreeTier', 'type': 'bool'}, + 'api_properties': {'key': 'properties.apiProperties', 'type': 'ApiProperties'}, + 'enable_analytical_storage': {'key': 'properties.enableAnalyticalStorage', 'type': 'bool'}, + 'analytical_storage_configuration': {'key': 'properties.analyticalStorageConfiguration', 'type': 'AnalyticalStorageConfiguration'}, + '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]'}, + 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + 'capacity': {'key': 'properties.capacity', 'type': 'Capacity'}, } def __init__( self, *, - automatic: Optional[bool] = None, - 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, - spatial_indexes: Optional[List["SpatialSpec"]] = None, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + consistency_policy: Optional["_models.ConsistencyPolicy"] = None, + locations: Optional[List["_models.Location"]] = None, + ip_rules: Optional[List["_models.IpAddressOrRange"]] = None, + is_virtual_network_filter_enabled: Optional[bool] = None, + enable_automatic_failover: Optional[bool] = None, + capabilities: Optional[List["_models.Capability"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, + enable_multiple_write_locations: Optional[bool] = None, + enable_cassandra_connector: Optional[bool] = None, + connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = None, + disable_key_based_metadata_write_access: Optional[bool] = None, + key_vault_key_uri: Optional[str] = None, + default_identity: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + enable_free_tier: Optional[bool] = None, + api_properties: Optional["_models.ApiProperties"] = None, + enable_analytical_storage: Optional[bool] = None, + analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = None, + backup_policy: Optional["_models.BackupPolicy"] = None, + cors: Optional[List["_models.CorsPolicy"]] = None, + network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, + network_acl_bypass_resource_ids: Optional[List[str]] = None, + disable_local_auth: Optional[bool] = None, + capacity: Optional["_models.Capacity"] = None, **kwargs ): """ - :keyword automatic: Indicates if the indexing policy is automatic. - :paramtype automatic: bool - :keyword indexing_mode: Indicates the indexing mode. Possible values include: "consistent", - "lazy", "none". Default value: "consistent". - :paramtype indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode - :keyword included_paths: List of paths to include in the indexing. - :paramtype included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] - :keyword excluded_paths: List of paths to exclude from indexing. - :paramtype excluded_paths: list[~azure.mgmt.cosmosdb.models.ExcludedPath] - :keyword composite_indexes: List of composite path list. - :paramtype composite_indexes: list[list[~azure.mgmt.cosmosdb.models.CompositePath]] - :keyword spatial_indexes: List of spatial specifics. - :paramtype spatial_indexes: list[~azure.mgmt.cosmosdb.models.SpatialSpec] + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :keyword consistency_policy: The consistency policy for the Cosmos DB account. + :paramtype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :keyword locations: An array that contains the georeplication locations enabled for the Cosmos + DB account. + :paramtype locations: list[~azure.mgmt.cosmosdb.models.Location] + :keyword ip_rules: List of IpRules. + :paramtype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] + :keyword is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual + Network ACL rules. + :paramtype is_virtual_network_filter_enabled: bool + :keyword enable_automatic_failover: Enables automatic failover of the write region in the rare + event that the region is unavailable due to an outage. Automatic failover will result in a new + write region for the account and is chosen based on the failover priorities configured for the + account. + :paramtype enable_automatic_failover: bool + :keyword capabilities: List of Cosmos DB capabilities for the account. + :paramtype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :keyword virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + account. + :paramtype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] + :keyword enable_multiple_write_locations: Enables the account to write in multiple locations. + :paramtype enable_multiple_write_locations: bool + :keyword enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* + account. + :paramtype enable_cassandra_connector: bool + :keyword connector_offer: The cassandra connector offer type for the Cosmos DB database C* + account. Known values are: "Small". + :paramtype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer + :keyword disable_key_based_metadata_write_access: Disable write operations on metadata + resources (databases, containers, throughput) via account keys. + :paramtype disable_key_based_metadata_write_access: bool + :keyword key_vault_key_uri: The URI of the key vault. + :paramtype key_vault_key_uri: str + :keyword default_identity: The default identity for accessing key vault used in features like + customer managed keys. The default identity needs to be explicitly set by the users. It can be + "FirstPartyIdentity", "SystemAssignedIdentity" and more. + :paramtype default_identity: str + :keyword public_network_access: Whether requests from Public Network are allowed. Known values + are: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess + :keyword enable_free_tier: Flag to indicate whether Free Tier is enabled. + :paramtype enable_free_tier: bool + :keyword api_properties: API specific properties. Currently, supported only for MongoDB API. + :paramtype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties + :keyword enable_analytical_storage: Flag to indicate whether to enable storage analytics. + :paramtype enable_analytical_storage: bool + :keyword analytical_storage_configuration: Analytical storage specific properties. + :paramtype analytical_storage_configuration: + ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration + :keyword backup_policy: The object representing the policy for taking backups on an account. + :paramtype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy + :keyword cors: The CORS policy for the Cosmos DB database account. + :paramtype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :keyword network_acl_bypass: Indicates what services are allowed to bypass firewall checks. + Known values are: "None", "AzureServices". + :paramtype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :keyword network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network + Acl Bypass for the Cosmos DB account. + :paramtype network_acl_bypass_resource_ids: list[str] + :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :paramtype disable_local_auth: bool + :keyword capacity: The object that represents all properties related to capacity enforcement on + an account. + :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity """ - super(IndexingPolicy, self).__init__(**kwargs) - self.automatic = automatic - self.indexing_mode = indexing_mode - self.included_paths = included_paths - self.excluded_paths = excluded_paths - self.composite_indexes = composite_indexes - self.spatial_indexes = spatial_indexes - + 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 + self.is_virtual_network_filter_enabled = is_virtual_network_filter_enabled + self.enable_automatic_failover = enable_automatic_failover + self.capabilities = capabilities + self.virtual_network_rules = virtual_network_rules + self.enable_multiple_write_locations = enable_multiple_write_locations + self.enable_cassandra_connector = enable_cassandra_connector + self.connector_offer = connector_offer + self.disable_key_based_metadata_write_access = disable_key_based_metadata_write_access + self.key_vault_key_uri = key_vault_key_uri + self.default_identity = default_identity + self.public_network_access = public_network_access + self.enable_free_tier = enable_free_tier + self.api_properties = api_properties + self.enable_analytical_storage = enable_analytical_storage + self.analytical_storage_configuration = analytical_storage_configuration + 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 + self.disable_local_auth = disable_local_auth + self.capacity = capacity -class IpAddressOrRange(msrest.serialization.Model): - """IpAddressOrRange object. - :ivar ip_address_or_range: A single IPv4 address or a single IPv4 address range in CIDR format. - Provided IPs must be well-formatted and cannot be contained in one of the following ranges: - 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by - the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. - :vartype ip_address_or_range: str +class DatabaseRestoreResource(msrest.serialization.Model): + """Specific Databases to restore. + + :ivar database_name: The name of the database available for restore. + :vartype database_name: str + :ivar collection_names: The names of the collections available for restore. + :vartype collection_names: list[str] """ _attribute_map = { - 'ip_address_or_range': {'key': 'ipAddressOrRange', 'type': 'str'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + 'collection_names': {'key': 'collectionNames', 'type': '[str]'}, } def __init__( self, *, - ip_address_or_range: Optional[str] = None, + database_name: Optional[str] = None, + collection_names: Optional[List[str]] = None, **kwargs ): """ - :keyword ip_address_or_range: A single IPv4 address or a single IPv4 address range in CIDR - format. Provided IPs must be well-formatted and cannot be contained in one of the following - ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not - enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or - “23.40.210.0/8”. - :paramtype ip_address_or_range: str + :keyword database_name: The name of the database available for restore. + :paramtype database_name: str + :keyword collection_names: The names of the collections available for restore. + :paramtype collection_names: list[str] """ - super(IpAddressOrRange, self).__init__(**kwargs) - self.ip_address_or_range = ip_address_or_range + super(DatabaseRestoreResource, self).__init__(**kwargs) + self.database_name = database_name + self.collection_names = collection_names + +class DataCenterResource(ARMProxyResource): + """A managed Cassandra data center. -class KeyWrapMetadata(msrest.serialization.Model): - """Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The name of associated KeyEncryptionKey (aka CustomerManagedKey). + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. :vartype name: str - :ivar type: ProviderName of KeyStoreProvider. + :ivar type: The type of Azure resource. :vartype type: str - :ivar value: Reference / link to the KeyEncryptionKey. - :vartype value: str - :ivar algorithm: Algorithm used in wrapping and unwrapping of the data encryption key. - :vartype algorithm: str + :ivar properties: Properties of a managed Cassandra data center. + :vartype properties: ~azure.mgmt.cosmosdb.models.DataCenterResourceProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'algorithm': {'key': 'algorithm', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DataCenterResourceProperties'}, } def __init__( self, *, - name: Optional[str] = None, - type: Optional[str] = None, - value: Optional[str] = None, - algorithm: Optional[str] = None, + properties: Optional["_models.DataCenterResourceProperties"] = None, **kwargs ): """ - :keyword name: The name of associated KeyEncryptionKey (aka CustomerManagedKey). - :paramtype name: str - :keyword type: ProviderName of KeyStoreProvider. - :paramtype type: str - :keyword value: Reference / link to the KeyEncryptionKey. - :paramtype value: str - :keyword algorithm: Algorithm used in wrapping and unwrapping of the data encryption key. - :paramtype algorithm: str + :keyword properties: Properties of a managed Cassandra data center. + :paramtype properties: ~azure.mgmt.cosmosdb.models.DataCenterResourceProperties """ - super(KeyWrapMetadata, self).__init__(**kwargs) - self.name = name - self.type = type - self.value = value - self.algorithm = algorithm + super(DataCenterResource, self).__init__(**kwargs) + self.properties = properties -class ListBackups(msrest.serialization.Model): - """List of restorable backups for a Cassandra cluster. +class DataCenterResourceProperties(msrest.serialization.Model): + """Properties of a managed Cassandra data center. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Container for array of backups. - :vartype value: list[~azure.mgmt.cosmosdb.models.BackupResource] + :ivar provisioning_state: The status of the resource at the time the operation was called. + Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.cosmosdb.models.ManagedCassandraProvisioningState + :ivar data_center_location: The region this data center should be created in. + :vartype data_center_location: str + :ivar delegated_subnet_id: Resource id of a subnet the nodes in this data center should have + their network interfaces connected to. The subnet must be in the same region specified in + 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's + 'delegatedManagementSubnetId' property. This resource id will be of the form + '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/virtualNetworks/:code:``/subnets/:code:``'. + :vartype delegated_subnet_id: str + :ivar node_count: The number of nodes the data center should have. This is the desired number. + After it is set, it may take some time for the data center to be scaled to match. To monitor + the number of nodes and their status, use the fetchNodeStatus method on the cluster. + :vartype node_count: int + :ivar seed_nodes: IP addresses for seed nodes in this data center. This is for reference. + Generally you will want to use the seedNodes property on the cluster, which aggregates the seed + nodes from all data centers in the cluster. + :vartype seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] + :ivar base64_encoded_cassandra_yaml_fragment: A fragment of a cassandra.yaml configuration file + to be included in the cassandra.yaml for all nodes in this data center. The fragment should be + Base64 encoded, and only a subset of keys are allowed. + :vartype base64_encoded_cassandra_yaml_fragment: str + :ivar managed_disk_customer_key_uri: Key uri to use for encryption of managed disks. Ensure the + system assigned identity of the cluster has been assigned appropriate permissions(key + get/wrap/unwrap permissions) on the key. + :vartype managed_disk_customer_key_uri: str + :ivar backup_storage_customer_key_uri: Indicates the Key Uri of the customer key to use for + encryption of the backup storage account. + :vartype backup_storage_customer_key_uri: str + :ivar sku: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. + :vartype sku: str + :ivar disk_sku: Disk SKU used for data centers. Default value is P30. + :vartype disk_sku: str + :ivar disk_capacity: Number of disk used for data centers. Default value is 4. + :vartype disk_capacity: int + :ivar availability_zone: If the azure data center has Availability Zone support, apply it to + the Virtual Machine ScaleSet that host the cassandra data center virtual machines. + :vartype availability_zone: bool """ _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BackupResource]'}, + 'seed_nodes': {'readonly': True}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ListBackups, self).__init__(**kwargs) - self.value = None - - -class ListClusters(msrest.serialization.Model): - """List of managed Cassandra clusters. - - :ivar value: Container for the array of clusters. - :vartype value: list[~azure.mgmt.cosmosdb.models.ClusterResource] - """ - _attribute_map = { - 'value': {'key': 'value', 'type': '[ClusterResource]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'data_center_location': {'key': 'dataCenterLocation', 'type': 'str'}, + 'delegated_subnet_id': {'key': 'delegatedSubnetId', 'type': 'str'}, + 'node_count': {'key': 'nodeCount', 'type': 'int'}, + 'seed_nodes': {'key': 'seedNodes', 'type': '[SeedNode]'}, + 'base64_encoded_cassandra_yaml_fragment': {'key': 'base64EncodedCassandraYamlFragment', 'type': 'str'}, + 'managed_disk_customer_key_uri': {'key': 'managedDiskCustomerKeyUri', 'type': 'str'}, + 'backup_storage_customer_key_uri': {'key': 'backupStorageCustomerKeyUri', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'disk_sku': {'key': 'diskSku', 'type': 'str'}, + 'disk_capacity': {'key': 'diskCapacity', 'type': 'int'}, + 'availability_zone': {'key': 'availabilityZone', 'type': 'bool'}, } def __init__( self, *, - value: Optional[List["ClusterResource"]] = None, + provisioning_state: Optional[Union[str, "_models.ManagedCassandraProvisioningState"]] = None, + data_center_location: Optional[str] = None, + delegated_subnet_id: Optional[str] = None, + node_count: Optional[int] = None, + base64_encoded_cassandra_yaml_fragment: Optional[str] = None, + managed_disk_customer_key_uri: Optional[str] = None, + backup_storage_customer_key_uri: Optional[str] = None, + sku: Optional[str] = None, + disk_sku: Optional[str] = None, + disk_capacity: Optional[int] = None, + availability_zone: Optional[bool] = None, **kwargs ): """ - :keyword value: Container for the array of clusters. - :paramtype value: list[~azure.mgmt.cosmosdb.models.ClusterResource] + :keyword provisioning_state: The status of the resource at the time the operation was called. + Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :paramtype provisioning_state: str or + ~azure.mgmt.cosmosdb.models.ManagedCassandraProvisioningState + :keyword data_center_location: The region this data center should be created in. + :paramtype data_center_location: str + :keyword delegated_subnet_id: Resource id of a subnet the nodes in this data center should have + their network interfaces connected to. The subnet must be in the same region specified in + 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's + 'delegatedManagementSubnetId' property. This resource id will be of the form + '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/virtualNetworks/:code:``/subnets/:code:``'. + :paramtype delegated_subnet_id: str + :keyword node_count: The number of nodes the data center should have. This is the desired + number. After it is set, it may take some time for the data center to be scaled to match. To + monitor the number of nodes and their status, use the fetchNodeStatus method on the cluster. + :paramtype node_count: int + :keyword base64_encoded_cassandra_yaml_fragment: A fragment of a cassandra.yaml configuration + file to be included in the cassandra.yaml for all nodes in this data center. The fragment + should be Base64 encoded, and only a subset of keys are allowed. + :paramtype base64_encoded_cassandra_yaml_fragment: str + :keyword managed_disk_customer_key_uri: Key uri to use for encryption of managed disks. Ensure + the system assigned identity of the cluster has been assigned appropriate permissions(key + get/wrap/unwrap permissions) on the key. + :paramtype managed_disk_customer_key_uri: str + :keyword backup_storage_customer_key_uri: Indicates the Key Uri of the customer key to use for + encryption of the backup storage account. + :paramtype backup_storage_customer_key_uri: str + :keyword sku: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. + :paramtype sku: str + :keyword disk_sku: Disk SKU used for data centers. Default value is P30. + :paramtype disk_sku: str + :keyword disk_capacity: Number of disk used for data centers. Default value is 4. + :paramtype disk_capacity: int + :keyword availability_zone: If the azure data center has Availability Zone support, apply it to + the Virtual Machine ScaleSet that host the cassandra data center virtual machines. + :paramtype availability_zone: bool """ - super(ListClusters, self).__init__(**kwargs) - self.value = value + super(DataCenterResourceProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + self.data_center_location = data_center_location + self.delegated_subnet_id = delegated_subnet_id + self.node_count = node_count + self.seed_nodes = None + self.base64_encoded_cassandra_yaml_fragment = base64_encoded_cassandra_yaml_fragment + self.managed_disk_customer_key_uri = managed_disk_customer_key_uri + self.backup_storage_customer_key_uri = backup_storage_customer_key_uri + self.sku = sku + self.disk_sku = disk_sku + self.disk_capacity = disk_capacity + self.availability_zone = availability_zone -class ListDataCenters(msrest.serialization.Model): - """List of managed Cassandra data centers and their properties. +class RegionalServiceResource(msrest.serialization.Model): + """Resource for a regional service location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Container for array of data centers. - :vartype value: list[~azure.mgmt.cosmosdb.models.DataCenterResource] + :ivar name: The regional service name. + :vartype name: str + :ivar location: The location name. + :vartype location: str + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". + :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus """ _validation = { - 'value': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'readonly': True}, + 'status': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DataCenterResource]'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, } def __init__( @@ -6861,340 +3739,358 @@ def __init__( ): """ """ - super(ListDataCenters, self).__init__(**kwargs) - self.value = None + super(RegionalServiceResource, self).__init__(**kwargs) + self.name = None + self.location = None + self.status = None -class Location(msrest.serialization.Model): - """A region in which the Azure Cosmos DB database account is deployed. +class DataTransferRegionalServiceResource(RegionalServiceResource): + """Resource for a regional service location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique identifier of the region within the database account. Example: - <accountName>-<locationName>. - :vartype id: str - :ivar location_name: The name of the region. - :vartype location_name: str - :ivar document_endpoint: The connection endpoint for the specific region. Example: - https://<accountName>-<locationName>.documents.azure.com:443/. - :vartype document_endpoint: str - :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 - the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is - active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB - account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – - the Cosmos DB account deletion failed. - :vartype provisioning_state: str - :ivar failover_priority: The failover priority of the region. A failover priority of 0 - indicates a write region. The maximum value for a failover priority = (total number of regions - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :vartype failover_priority: int - :ivar is_zone_redundant: Flag to indicate whether or not this region is an AvailabilityZone - region. - :vartype is_zone_redundant: bool + :ivar name: The regional service name. + :vartype name: str + :ivar location: The location name. + :vartype location: str + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". + :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus """ _validation = { - 'id': {'readonly': True}, - 'document_endpoint': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'failover_priority': {'minimum': 0}, + 'name': {'readonly': True}, + 'location': {'readonly': True}, + 'status': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'location_name': {'key': 'locationName', 'type': 'str'}, - 'document_endpoint': {'key': 'documentEndpoint', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, - 'is_zone_redundant': {'key': 'isZoneRedundant', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, } def __init__( self, - *, - location_name: Optional[str] = None, - failover_priority: Optional[int] = None, - is_zone_redundant: Optional[bool] = None, **kwargs ): """ - :keyword location_name: The name of the region. - :paramtype location_name: str - :keyword failover_priority: The failover priority of the region. A failover priority of 0 - indicates a write region. The maximum value for a failover priority = (total number of regions - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :paramtype failover_priority: int - :keyword is_zone_redundant: Flag to indicate whether or not this region is an AvailabilityZone - region. - :paramtype is_zone_redundant: bool """ - super(Location, self).__init__(**kwargs) - self.id = None - self.location_name = location_name - self.document_endpoint = None - self.provisioning_state = None - self.failover_priority = failover_priority - self.is_zone_redundant = is_zone_redundant - + super(DataTransferRegionalServiceResource, self).__init__(**kwargs) -class LocationGetResult(ARMProxyResource): - """Cosmos DB location get result. - Variables are only populated by the server, and will be ignored when sending a request. +class DataTransferServiceResource(msrest.serialization.Model): + """Describes the service response property. - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar properties: Cosmos DB location metadata. - :vartype properties: ~azure.mgmt.cosmosdb.models.LocationProperties + :ivar properties: Properties for DataTransferServiceResource. + :vartype properties: ~azure.mgmt.cosmosdb.models.DataTransferServiceResourceProperties """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LocationProperties'}, + 'properties': {'key': 'properties', 'type': 'DataTransferServiceResourceProperties'}, } def __init__( self, *, - properties: Optional["LocationProperties"] = None, + properties: Optional["_models.DataTransferServiceResourceProperties"] = None, **kwargs ): """ - :keyword properties: Cosmos DB location metadata. - :paramtype properties: ~azure.mgmt.cosmosdb.models.LocationProperties + :keyword properties: Properties for DataTransferServiceResource. + :paramtype properties: ~azure.mgmt.cosmosdb.models.DataTransferServiceResourceProperties """ - super(LocationGetResult, self).__init__(**kwargs) + super(DataTransferServiceResource, self).__init__(**kwargs) self.properties = properties -class LocationListResult(msrest.serialization.Model): - """The List operation response, that contains Cosmos DB locations and their properties. +class ServiceResourceProperties(msrest.serialization.Model): + """Services response resource. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: DataTransferServiceResourceProperties, GraphAPIComputeServiceResourceProperties, MaterializedViewsBuilderServiceResourceProperties, SqlDedicatedGatewayServiceResourceProperties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Cosmos DB locations and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.LocationGetResult] + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar creation_time: Time of the last state change (ISO-8601 format). + :vartype creation_time: ~datetime.datetime + :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", "Cosmos.D16s". + :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize + :ivar instance_count: Instance count for the service. + :vartype instance_count: int + :ivar service_type: Required. ServiceType for the service.Constant filled by server. Known + values are: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", + "MaterializedViewsBuilder". + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". + :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus """ _validation = { - 'value': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'instance_count': {'minimum': 0}, + 'service_type': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[LocationGetResult]'}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, + 'instance_size': {'key': 'instanceSize', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + 'service_type': {'key': 'serviceType', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + _subtype_map = { + 'service_type': {'DataTransfer': 'DataTransferServiceResourceProperties', 'GraphAPICompute': 'GraphAPIComputeServiceResourceProperties', 'MaterializedViewsBuilder': 'MaterializedViewsBuilderServiceResourceProperties', 'SqlDedicatedGateway': 'SqlDedicatedGatewayServiceResourceProperties'} } def __init__( self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, **kwargs ): """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", "Cosmos.D16s". + :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize + :keyword instance_count: Instance count for the service. + :paramtype instance_count: int """ - super(LocationListResult, self).__init__(**kwargs) - self.value = None + super(ServiceResourceProperties, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.creation_time = None + self.instance_size = instance_size + self.instance_count = instance_count + self.service_type = 'ServiceResourceProperties' # type: str + self.status = None -class LocationProperties(msrest.serialization.Model): - """Cosmos DB location metadata. +class DataTransferServiceResourceProperties(ServiceResourceProperties): + """Properties for DataTransferServiceResource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar status: The current status of location in Azure. - :vartype status: str - :ivar supports_availability_zone: Flag indicating whether the location supports availability - zones or not. - :vartype supports_availability_zone: bool - :ivar is_residency_restricted: Flag indicating whether the location is residency sensitive. - :vartype is_residency_restricted: bool - :ivar backup_storage_redundancies: The properties of available backup storage redundancies. - :vartype backup_storage_redundancies: list[str or - ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy] + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar creation_time: Time of the last state change (ISO-8601 format). + :vartype creation_time: ~datetime.datetime + :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", "Cosmos.D16s". + :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize + :ivar instance_count: Instance count for the service. + :vartype instance_count: int + :ivar service_type: Required. ServiceType for the service.Constant filled by server. Known + values are: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", + "MaterializedViewsBuilder". + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". + :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus + :ivar locations: An array that contains all of the locations for the service. + :vartype locations: list[~azure.mgmt.cosmosdb.models.DataTransferRegionalServiceResource] """ _validation = { + 'creation_time': {'readonly': True}, + 'instance_count': {'minimum': 0}, + 'service_type': {'required': True}, 'status': {'readonly': True}, - 'supports_availability_zone': {'readonly': True}, - 'is_residency_restricted': {'readonly': True}, - 'backup_storage_redundancies': {'readonly': True}, + 'locations': {'readonly': True}, } _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, + 'instance_size': {'key': 'instanceSize', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + 'service_type': {'key': 'serviceType', 'type': 'str'}, 'status': {'key': 'status', 'type': 'str'}, - 'supports_availability_zone': {'key': 'supportsAvailabilityZone', 'type': 'bool'}, - 'is_residency_restricted': {'key': 'isResidencyRestricted', 'type': 'bool'}, - 'backup_storage_redundancies': {'key': 'backupStorageRedundancies', 'type': '[str]'}, + 'locations': {'key': 'locations', 'type': '[DataTransferRegionalServiceResource]'}, } def __init__( self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, **kwargs ): """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", "Cosmos.D16s". + :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize + :keyword instance_count: Instance count for the service. + :paramtype instance_count: int """ - super(LocationProperties, self).__init__(**kwargs) - self.status = None - self.supports_availability_zone = None - self.is_residency_restricted = None - self.backup_storage_redundancies = None - + super(DataTransferServiceResourceProperties, self).__init__(additional_properties=additional_properties, instance_size=instance_size, instance_count=instance_count, **kwargs) + self.service_type = 'DataTransfer' # type: str + self.locations = None -class ManagedCassandraManagedServiceIdentity(msrest.serialization.Model): - """Identity for the resource. - Variables are only populated by the server, and will be ignored when sending a request. +class ErrorResponse(msrest.serialization.Model): + """Error Response. - :ivar principal_id: The object id of the identity resource. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the resource. - :vartype tenant_id: str - :ivar type: The type of the resource. Possible values include: "SystemAssigned", "None". - :vartype type: str or ~azure.mgmt.cosmosdb.models.ManagedCassandraResourceIdentityType + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str """ - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, } + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message indicating why the operation failed. + :paramtype message: str + """ + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ExcludedPath(msrest.serialization.Model): + """ExcludedPath. + + :ivar path: The path for which the indexing behavior applies to. Index paths typically start + with root and end with wildcard (/path/*). + :vartype path: str + """ + _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, } def __init__( self, *, - type: Optional[Union[str, "ManagedCassandraResourceIdentityType"]] = None, + path: Optional[str] = None, **kwargs ): """ - :keyword type: The type of the resource. Possible values include: "SystemAssigned", "None". - :paramtype type: str or ~azure.mgmt.cosmosdb.models.ManagedCassandraResourceIdentityType - """ - super(ManagedCassandraManagedServiceIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type + :keyword path: The path for which the indexing behavior applies to. Index paths typically start + with root and end with wildcard (/path/*). + :paramtype path: str + """ + super(ExcludedPath, self).__init__(**kwargs) + self.path = path -class ManagedCassandraReaperStatus(msrest.serialization.Model): - """ManagedCassandraReaperStatus. +class FailoverPolicies(msrest.serialization.Model): + """The list of new failover policies for the failover priority change. - :ivar healthy: - :vartype healthy: bool - :ivar repair_run_ids: Dictionary of :code:``. - :vartype repair_run_ids: dict[str, str] - :ivar repair_schedules: Dictionary of :code:``. - :vartype repair_schedules: dict[str, str] + All required parameters must be populated in order to send to Azure. + + :ivar failover_policies: Required. List of failover policies. + :vartype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] """ + _validation = { + 'failover_policies': {'required': True}, + } + _attribute_map = { - 'healthy': {'key': 'healthy', 'type': 'bool'}, - 'repair_run_ids': {'key': 'repairRunIds', 'type': '{str}'}, - 'repair_schedules': {'key': 'repairSchedules', 'type': '{str}'}, + 'failover_policies': {'key': 'failoverPolicies', 'type': '[FailoverPolicy]'}, } def __init__( self, *, - healthy: Optional[bool] = None, - repair_run_ids: Optional[Dict[str, str]] = None, - repair_schedules: Optional[Dict[str, str]] = None, + failover_policies: List["_models.FailoverPolicy"], **kwargs ): """ - :keyword healthy: - :paramtype healthy: bool - :keyword repair_run_ids: Dictionary of :code:``. - :paramtype repair_run_ids: dict[str, str] - :keyword repair_schedules: Dictionary of :code:``. - :paramtype repair_schedules: dict[str, str] + :keyword failover_policies: Required. List of failover policies. + :paramtype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] """ - super(ManagedCassandraReaperStatus, self).__init__(**kwargs) - self.healthy = healthy - self.repair_run_ids = repair_run_ids - self.repair_schedules = repair_schedules + super(FailoverPolicies, self).__init__(**kwargs) + self.failover_policies = failover_policies -class ManagedServiceIdentity(msrest.serialization.Model): - """Identity for the resource. +class FailoverPolicy(msrest.serialization.Model): + """The failover policy for a given region of a database account. Variables are only populated by the server, and will be ignored when sending a request. - :ivar 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 - :ivar 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". - :vartype type: str or ~azure.mgmt.cosmosdb.models.ResourceIdentityType - :ivar 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}'. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.cosmosdb.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + :ivar id: The unique identifier of the region in which the database account replicates to. + Example: <accountName>-<locationName>. + :vartype id: str + :ivar location_name: The name of the region in which the database account exists. + :vartype location_name: str + :ivar failover_priority: The failover priority of the region. A failover priority of 0 + indicates a write region. The maximum value for a failover priority = (total number of regions + - 1). Failover priority values must be unique for each of the regions in which the database + account exists. + :vartype failover_priority: int """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + 'id': {'readonly': True}, + 'failover_priority': {'minimum': 0}, } _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}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, } def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + location_name: Optional[str] = None, + failover_priority: Optional[int] = None, **kwargs ): """ - :keyword 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". - :paramtype type: str or ~azure.mgmt.cosmosdb.models.ResourceIdentityType - :keyword 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}'. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.cosmosdb.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + :keyword location_name: The name of the region in which the database account exists. + :paramtype location_name: str + :keyword failover_priority: The failover priority of the region. A failover priority of 0 + indicates a write region. The maximum value for a failover priority = (total number of regions + - 1). Failover priority values must be unique for each of the regions in which the database + account exists. + :paramtype failover_priority: int """ - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities + super(FailoverPolicy, self).__init__(**kwargs) + self.id = None + self.location_name = location_name + self.failover_priority = failover_priority -class MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): +class GraphAPIComputeRegionalServiceResource(RegionalServiceResource): """Resource for a regional service location. Variables are only populated by the server, and will be ignored when sending a request. @@ -7203,21 +4099,25 @@ class MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): :vartype name: str :ivar location: The location name. :vartype location: str - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus + :ivar graph_api_compute_endpoint: The regional endpoint for GraphAPICompute. + :vartype graph_api_compute_endpoint: str """ _validation = { 'name': {'readonly': True}, 'location': {'readonly': True}, 'status': {'readonly': True}, + 'graph_api_compute_endpoint': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'status': {'key': 'status', 'type': 'str'}, + 'graph_api_compute_endpoint': {'key': 'graphApiComputeEndpoint', 'type': 'str'}, } def __init__( @@ -7226,38 +4126,37 @@ def __init__( ): """ """ - super(MaterializedViewsBuilderRegionalServiceResource, self).__init__(**kwargs) + super(GraphAPIComputeRegionalServiceResource, self).__init__(**kwargs) + self.graph_api_compute_endpoint = None -class MaterializedViewsBuilderServiceResource(msrest.serialization.Model): - """Describes the service response property for MaterializedViewsBuilder. +class GraphAPIComputeServiceResource(msrest.serialization.Model): + """Describes the service response property for GraphAPICompute. - :ivar properties: Properties for MaterializedViewsBuilderServiceResource. - :vartype properties: - ~azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceProperties + :ivar properties: Properties for GraphAPIComputeServiceResource. + :vartype properties: ~azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'MaterializedViewsBuilderServiceResourceProperties'}, + 'properties': {'key': 'properties', 'type': 'GraphAPIComputeServiceResourceProperties'}, } def __init__( self, *, - properties: Optional["MaterializedViewsBuilderServiceResourceProperties"] = None, + properties: Optional["_models.GraphAPIComputeServiceResourceProperties"] = None, **kwargs ): """ - :keyword properties: Properties for MaterializedViewsBuilderServiceResource. - :paramtype properties: - ~azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceProperties + :keyword properties: Properties for GraphAPIComputeServiceResource. + :paramtype properties: ~azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties """ - super(MaterializedViewsBuilderServiceResource, self).__init__(**kwargs) + super(GraphAPIComputeServiceResource, self).__init__(**kwargs) self.properties = properties -class MaterializedViewsBuilderServiceResourceProperties(ServiceResourceProperties): - """Properties for MaterializedViewsBuilderServiceResource. +class GraphAPIComputeServiceResourceProperties(ServiceResourceProperties): + """Properties for GraphAPIComputeServiceResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -7268,21 +4167,22 @@ class MaterializedViewsBuilderServiceResourceProperties(ServiceResourcePropertie :vartype additional_properties: dict[str, any] :ivar creation_time: Time of the last state change (ISO-8601 format). :vartype creation_time: ~datetime.datetime - :ivar instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", + :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", "Cosmos.D16s". :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize :ivar instance_count: Instance count for the service. :vartype instance_count: int - :ivar service_type: Required. ServiceType for the service.Constant filled by server. Possible - values include: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", + :ivar service_type: Required. ServiceType for the service.Constant filled by server. Known + values are: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", "MaterializedViewsBuilder". :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus + :ivar graph_api_compute_endpoint: GraphAPICompute endpoint for the service. + :vartype graph_api_compute_endpoint: str :ivar locations: An array that contains all of the locations for the service. - :vartype locations: - list[~azure.mgmt.cosmosdb.models.MaterializedViewsBuilderRegionalServiceResource] + :vartype locations: list[~azure.mgmt.cosmosdb.models.GraphAPIComputeRegionalServiceResource] """ _validation = { @@ -7300,175 +4200,311 @@ class MaterializedViewsBuilderServiceResourceProperties(ServiceResourcePropertie 'instance_count': {'key': 'instanceCount', 'type': 'int'}, 'service_type': {'key': 'serviceType', 'type': 'str'}, 'status': {'key': 'status', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[MaterializedViewsBuilderRegionalServiceResource]'}, + 'graph_api_compute_endpoint': {'key': 'graphApiComputeEndpoint', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[GraphAPIComputeRegionalServiceResource]'}, } def __init__( self, *, additional_properties: Optional[Dict[str, Any]] = None, - instance_size: Optional[Union[str, "ServiceSize"]] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, instance_count: Optional[int] = None, + graph_api_compute_endpoint: Optional[str] = None, **kwargs ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, any] - :keyword instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", + :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", "Cosmos.D16s". :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize :keyword instance_count: Instance count for the service. :paramtype instance_count: int + :keyword graph_api_compute_endpoint: GraphAPICompute endpoint for the service. + :paramtype graph_api_compute_endpoint: str """ - super(MaterializedViewsBuilderServiceResourceProperties, self).__init__(additional_properties=additional_properties, instance_size=instance_size, instance_count=instance_count, **kwargs) - self.service_type = 'MaterializedViewsBuilder' # type: str + super(GraphAPIComputeServiceResourceProperties, self).__init__(additional_properties=additional_properties, instance_size=instance_size, instance_count=instance_count, **kwargs) + self.service_type = 'GraphAPICompute' # type: str + self.graph_api_compute_endpoint = graph_api_compute_endpoint self.locations = None -class MergeParameters(msrest.serialization.Model): - """The properties of an Azure Cosmos DB merge operations. +class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These + tags can be used in viewing and grouping this resource (across resource groups). A maximum of + 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters + and value no greater than 256 characters. For example, the default experience for a template + type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also + include "Table", "Graph", "DocumentDB", and "MongoDB". + :vartype tags: dict[str, str] + :ivar resource: Required. The standard JSON format of a Gremlin database. + :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource + :ivar options: A key-value pair of options to be applied for the request. This corresponds to + the headers sent with the request. + :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, + } + + def __init__( + self, + *, + resource: "_models.GremlinDatabaseResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + options: Optional["_models.CreateUpdateOptions"] = None, + **kwargs + ): + """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword resource: Required. The standard JSON format of a Gremlin database. + :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource + :keyword options: A key-value pair of options to be applied for the request. This corresponds + to the headers sent with the request. + :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + """ + super(GremlinDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class GremlinDatabaseGetPropertiesOptions(OptionsResource): + """GremlinDatabaseGetPropertiesOptions. + + :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + ThroughputSetting resource when retrieving offer details. + :vartype throughput: int + :ivar autoscale_settings: Specifies the Autoscale settings. + :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + """ + + _attribute_map = { + 'throughput': {'key': 'throughput', 'type': 'int'}, + 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, + } + + def __init__( + self, + *, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, + **kwargs + ): + """ + :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + ThroughputSetting resource when retrieving offer details. + :paramtype throughput: int + :keyword autoscale_settings: Specifies the Autoscale settings. + :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + """ + super(GremlinDatabaseGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) + + +class GremlinDatabaseResource(msrest.serialization.Model): + """Cosmos DB Gremlin database resource object. + + All required parameters must be populated in order to send to Azure. - :ivar is_dry_run: Specifies whether the operation is a real merge operation or a simulation. - :vartype is_dry_run: bool + :ivar id: Required. Name of the Cosmos DB Gremlin database. + :vartype id: str """ + _validation = { + 'id': {'required': True}, + } + _attribute_map = { - 'is_dry_run': {'key': 'isDryRun', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, *, - is_dry_run: Optional[bool] = None, + id: str, **kwargs ): """ - :keyword is_dry_run: Specifies whether the operation is a real merge operation or a simulation. - :paramtype is_dry_run: bool + :keyword id: Required. Name of the Cosmos DB Gremlin database. + :paramtype id: str """ - super(MergeParameters, self).__init__(**kwargs) - self.is_dry_run = is_dry_run + super(GremlinDatabaseResource, self).__init__(**kwargs) + self.id = id -class Metric(msrest.serialization.Model): - """Metric data. +class GremlinDatabaseGetPropertiesResource(ExtendedResourceProperties, GremlinDatabaseResource): + """GremlinDatabaseGetPropertiesResource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar start_time: The start time for the metric (ISO-8601 format). - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time for the metric (ISO-8601 format). - :vartype end_time: ~datetime.datetime - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond", "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar metric_values: The metric values for the specified time window and timestep. - :vartype metric_values: list[~azure.mgmt.cosmosdb.models.MetricValue] + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Name of the Cosmos DB Gremlin database. + :vartype id: str + :ivar rid: A system generated property. A unique identifier. + :vartype rid: str + :ivar ts: A system generated property that denotes the last updated timestamp of the resource. + :vartype ts: float + :ivar etag: A system generated property representing the resource etag required for optimistic + concurrency control. + :vartype etag: str """ _validation = { - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'time_grain': {'readonly': True}, - 'unit': {'readonly': True}, - 'name': {'readonly': True}, - 'metric_values': {'readonly': True}, + 'id': {'required': True}, + 'rid': {'readonly': True}, + 'ts': {'readonly': True}, + 'etag': {'readonly': True}, } _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'MetricName'}, - 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'rid': {'key': '_rid', 'type': 'str'}, + 'ts': {'key': '_ts', 'type': 'float'}, + 'etag': {'key': '_etag', 'type': 'str'}, } def __init__( self, + *, + id: str, **kwargs ): """ + :keyword id: Required. Name of the Cosmos DB Gremlin database. + :paramtype id: str """ - super(Metric, self).__init__(**kwargs) - self.start_time = None - self.end_time = None - self.time_grain = None - self.unit = None - self.name = None - self.metric_values = None + super(GremlinDatabaseGetPropertiesResource, self).__init__(id=id, **kwargs) + self.id = id + self.rid = None + self.ts = None + self.etag = None -class MetricAvailability(msrest.serialization.Model): - """The availability of the metric. +class GremlinDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin database. Variables are only populated by the server, and will be ignored when sending a request. - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar retention: The retention for the metric values. - :vartype retention: str + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These + tags can be used in viewing and grouping this resource (across resource groups). A maximum of + 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters + and value no greater than 256 characters. For example, the default experience for a template + type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also + include "Table", "Graph", "DocumentDB", and "MongoDB". + :vartype tags: dict[str, str] + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions """ _validation = { - 'time_grain': {'readonly': True}, - 'retention': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'retention': {'key': 'retention', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseGetPropertiesResource'}, + 'options': {'key': 'properties.options', 'type': 'GremlinDatabaseGetPropertiesOptions'}, } def __init__( self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + resource: Optional["_models.GremlinDatabaseGetPropertiesResource"] = None, + options: Optional["_models.GremlinDatabaseGetPropertiesOptions"] = None, **kwargs ): """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword resource: + :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesResource + :keyword options: + :paramtype options: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions """ - super(MetricAvailability, self).__init__(**kwargs) - self.time_grain = None - self.retention = None + super(GremlinDatabaseGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options -class MetricDefinition(msrest.serialization.Model): - """The definition of a metric. +class GremlinDatabaseListResult(msrest.serialization.Model): + """The List operation response, that contains the Gremlin databases and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar metric_availabilities: The list of metric availabilities for the account. - :vartype metric_availabilities: list[~azure.mgmt.cosmosdb.models.MetricAvailability] - :ivar primary_aggregation_type: The primary aggregation type of the metric. Possible values - include: "None", "Average", "Total", "Minimum", "Maximum", "Last". - :vartype primary_aggregation_type: str or ~azure.mgmt.cosmosdb.models.PrimaryAggregationType - :ivar unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond", "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar resource_uri: The resource uri of the database. - :vartype resource_uri: str - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar value: List of Gremlin databases and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] """ _validation = { - 'metric_availabilities': {'readonly': True}, - 'primary_aggregation_type': {'readonly': True}, - 'unit': {'readonly': True}, - 'resource_uri': {'readonly': True}, - 'name': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, - 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'MetricName'}, + 'value': {'key': 'value', 'type': '[GremlinDatabaseGetResults]'}, } def __init__( @@ -7477,159 +4513,299 @@ def __init__( ): """ """ - super(MetricDefinition, self).__init__(**kwargs) - self.metric_availabilities = None - self.primary_aggregation_type = None - self.unit = None - self.resource_uri = None - self.name = None + super(GremlinDatabaseListResult, self).__init__(**kwargs) + self.value = None -class MetricDefinitionsListResult(msrest.serialization.Model): - """The response to a list metric definitions request. +class GremlinGraphCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Gremlin graph. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of metric definitions for the account. - :vartype value: list[~azure.mgmt.cosmosdb.models.MetricDefinition] + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These + tags can be used in viewing and grouping this resource (across resource groups). A maximum of + 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters + and value no greater than 256 characters. For example, the default experience for a template + type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also + include "Table", "Graph", "DocumentDB", and "MongoDB". + :vartype tags: dict[str, str] + :ivar resource: Required. The standard JSON format of a Gremlin graph. + :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphResource + :ivar options: A key-value pair of options to be applied for the request. This corresponds to + the headers sent with the request. + :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ _validation = { - 'value': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MetricDefinition]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphResource'}, + 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } def __init__( self, + *, + resource: "_models.GremlinGraphResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword resource: Required. The standard JSON format of a Gremlin graph. + :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphResource + :keyword options: A key-value pair of options to be applied for the request. This corresponds + to the headers sent with the request. + :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(MetricDefinitionsListResult, self).__init__(**kwargs) - self.value = None - + super(GremlinGraphCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options -class MetricListResult(msrest.serialization.Model): - """The response to a list metrics request. - Variables are only populated by the server, and will be ignored when sending a request. +class GremlinGraphGetPropertiesOptions(OptionsResource): + """GremlinGraphGetPropertiesOptions. - :ivar value: The list of metrics for the account. - :vartype value: list[~azure.mgmt.cosmosdb.models.Metric] + :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + ThroughputSetting resource when retrieving offer details. + :vartype throughput: int + :ivar autoscale_settings: Specifies the Autoscale settings. + :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings """ - _validation = { - 'value': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[Metric]'}, + 'throughput': {'key': 'throughput', 'type': 'int'}, + 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, } def __init__( self, + *, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, **kwargs ): """ + :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + ThroughputSetting resource when retrieving offer details. + :paramtype throughput: int + :keyword autoscale_settings: Specifies the Autoscale settings. + :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings """ - super(MetricListResult, self).__init__(**kwargs) - self.value = None + super(GremlinGraphGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) -class MetricName(msrest.serialization.Model): - """A metric name. +class GremlinGraphResource(msrest.serialization.Model): + """Cosmos DB Gremlin graph resource object. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar value: The name of the metric. - :vartype value: str - :ivar localized_value: The friendly name of the metric. - :vartype localized_value: str + :ivar id: Required. Name of the Cosmos DB Gremlin graph. + :vartype id: str + :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the graph. + :vartype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :ivar partition_key: The configuration of the partition key to be used for partitioning data + into multiple partitions. + :vartype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :ivar default_ttl: Default time to live. + :vartype default_ttl: int + :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness + constraints on documents in the collection in the Azure Cosmos DB service. + :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :ivar conflict_resolution_policy: The conflict resolution policy for the graph. + :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :ivar analytical_storage_ttl: Analytical TTL. + :vartype analytical_storage_ttl: long """ _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, + 'id': {'required': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'long'}, } def __init__( self, + *, + id: str, + indexing_policy: Optional["_models.IndexingPolicy"] = None, + partition_key: Optional["_models.ContainerPartitionKey"] = None, + default_ttl: Optional[int] = None, + unique_key_policy: Optional["_models.UniqueKeyPolicy"] = None, + conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, + analytical_storage_ttl: Optional[int] = None, **kwargs ): """ + :keyword id: Required. Name of the Cosmos DB Gremlin graph. + :paramtype id: str + :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the graph. + :paramtype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :keyword partition_key: The configuration of the partition key to be used for partitioning data + into multiple partitions. + :paramtype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :keyword default_ttl: Default time to live. + :paramtype default_ttl: int + :keyword unique_key_policy: The unique key policy configuration for specifying uniqueness + constraints on documents in the collection in the Azure Cosmos DB service. + :paramtype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :keyword conflict_resolution_policy: The conflict resolution policy for the graph. + :paramtype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :keyword analytical_storage_ttl: Analytical TTL. + :paramtype analytical_storage_ttl: long """ - super(MetricName, self).__init__(**kwargs) - self.value = None - self.localized_value = None + super(GremlinGraphResource, self).__init__(**kwargs) + self.id = id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + self.analytical_storage_ttl = analytical_storage_ttl -class MetricValue(msrest.serialization.Model): - """Represents metrics values. +class GremlinGraphGetPropertiesResource(ExtendedResourceProperties, GremlinGraphResource): + """GremlinGraphGetPropertiesResource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar count: The number of values for the metric. - :vartype count: int - :ivar average: The average value of the metric. - :vartype average: float - :ivar maximum: The max value of the metric. - :vartype maximum: float - :ivar minimum: The min value of the metric. - :vartype minimum: float - :ivar timestamp: The metric timestamp (ISO-8601 format). - :vartype timestamp: ~datetime.datetime - :ivar total: The total value of the metric. - :vartype total: float + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Name of the Cosmos DB Gremlin graph. + :vartype id: str + :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the graph. + :vartype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :ivar partition_key: The configuration of the partition key to be used for partitioning data + into multiple partitions. + :vartype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :ivar default_ttl: Default time to live. + :vartype default_ttl: int + :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness + constraints on documents in the collection in the Azure Cosmos DB service. + :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :ivar conflict_resolution_policy: The conflict resolution policy for the graph. + :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :ivar analytical_storage_ttl: Analytical TTL. + :vartype analytical_storage_ttl: long + :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: float + :ivar etag: A system generated property representing the resource etag required for optimistic + concurrency control. + :vartype etag: str """ _validation = { - 'count': {'readonly': True}, - 'average': {'readonly': True}, - 'maximum': {'readonly': True}, - 'minimum': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'total': {'readonly': True}, + 'id': {'required': True}, + 'rid': {'readonly': True}, + 'ts': {'readonly': True}, + 'etag': {'readonly': True}, } _attribute_map = { - 'count': {'key': '_count', 'type': 'int'}, - 'average': {'key': 'average', 'type': 'float'}, - 'maximum': {'key': 'maximum', 'type': 'float'}, - 'minimum': {'key': 'minimum', 'type': 'float'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'total': {'key': 'total', 'type': 'float'}, + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'long'}, + 'rid': {'key': '_rid', 'type': 'str'}, + 'ts': {'key': '_ts', 'type': 'float'}, + 'etag': {'key': '_etag', 'type': 'str'}, } def __init__( self, + *, + id: str, + indexing_policy: Optional["_models.IndexingPolicy"] = None, + partition_key: Optional["_models.ContainerPartitionKey"] = None, + default_ttl: Optional[int] = None, + unique_key_policy: Optional["_models.UniqueKeyPolicy"] = None, + conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, + analytical_storage_ttl: Optional[int] = None, **kwargs ): """ + :keyword id: Required. Name of the Cosmos DB Gremlin graph. + :paramtype id: str + :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the graph. + :paramtype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :keyword partition_key: The configuration of the partition key to be used for partitioning data + into multiple partitions. + :paramtype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :keyword default_ttl: Default time to live. + :paramtype default_ttl: int + :keyword unique_key_policy: The unique key policy configuration for specifying uniqueness + constraints on documents in the collection in the Azure Cosmos DB service. + :paramtype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :keyword conflict_resolution_policy: The conflict resolution policy for the graph. + :paramtype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :keyword analytical_storage_ttl: Analytical TTL. + :paramtype analytical_storage_ttl: long """ - super(MetricValue, self).__init__(**kwargs) - self.count = None - self.average = None - self.maximum = None - self.minimum = None - self.timestamp = None - self.total = None + super(GremlinGraphGetPropertiesResource, self).__init__(id=id, indexing_policy=indexing_policy, partition_key=partition_key, default_ttl=default_ttl, unique_key_policy=unique_key_policy, conflict_resolution_policy=conflict_resolution_policy, analytical_storage_ttl=analytical_storage_ttl, **kwargs) + self.id = id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + self.analytical_storage_ttl = analytical_storage_ttl + self.rid = None + self.ts = None + self.etag = None -class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB MongoDB collection. +class GremlinGraphGetResults(ARMResourceProperties): + """An Azure Cosmos DB Gremlin graph. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the ARM resource. :vartype id: str :ivar name: The name of the ARM resource. @@ -7645,304 +4821,288 @@ class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: Required. The standard JSON format of a MongoDB collection. - :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionResource - :ivar options: A key-value pair of options to be applied for the request. This corresponds to - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesOptions """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, - 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'GremlinGraphGetPropertiesResource'}, + 'options': {'key': 'properties.options', 'type': 'GremlinGraphGetPropertiesOptions'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + resource: Optional["_models.GremlinGraphGetPropertiesResource"] = None, + options: Optional["_models.GremlinGraphGetPropertiesOptions"] = None, + **kwargs + ): + """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword resource: + :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesResource + :keyword options: + :paramtype options: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesOptions + """ + super(GremlinGraphGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options + + +class GremlinGraphListResult(msrest.serialization.Model): + """The List operation response, that contains the graphs and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of graphs and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GremlinGraphGetResults]'}, } def __init__( self, - *, - resource: "MongoDBCollectionResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: Required. The standard JSON format of a MongoDB collection. - :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionResource - :keyword options: A key-value pair of options to be applied for the request. This corresponds - to the headers sent with the request. - :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(MongoDBCollectionCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options + super(GremlinGraphListResult, self).__init__(**kwargs) + self.value = None -class MongoDBCollectionGetPropertiesOptions(OptionsResource): - """MongoDBCollectionGetPropertiesOptions. +class IncludedPath(msrest.serialization.Model): + """The paths that are included in indexing. - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + :ivar path: The path for which the indexing behavior applies to. Index paths typically start + with root and end with wildcard (/path/*). + :vartype path: str + :ivar indexes: List of indexes for this path. + :vartype indexes: list[~azure.mgmt.cosmosdb.models.Indexes] """ _attribute_map = { - 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, + 'path': {'key': 'path', 'type': 'str'}, + 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, } def __init__( self, *, - throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, + path: Optional[str] = None, + indexes: Optional[List["_models.Indexes"]] = None, **kwargs ): """ - :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :paramtype throughput: int - :keyword autoscale_settings: Specifies the Autoscale settings. - :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + :keyword path: The path for which the indexing behavior applies to. Index paths typically start + with root and end with wildcard (/path/*). + :paramtype path: str + :keyword indexes: List of indexes for this path. + :paramtype indexes: list[~azure.mgmt.cosmosdb.models.Indexes] """ - super(MongoDBCollectionGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) - + super(IncludedPath, self).__init__(**kwargs) + self.path = path + self.indexes = indexes -class MongoDBCollectionResource(msrest.serialization.Model): - """Cosmos DB MongoDB collection resource object. - All required parameters must be populated in order to send to Azure. +class Indexes(msrest.serialization.Model): + """The indexes for the path. - :ivar id: Required. Name of the Cosmos DB MongoDB collection. - :vartype id: str - :ivar shard_key: A key-value pair of shard keys to be applied for the request. - :vartype shard_key: dict[str, str] - :ivar indexes: List of index keys. - :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] - :ivar analytical_storage_ttl: Analytical TTL. - :vartype analytical_storage_ttl: int + :ivar data_type: The datatype for which the indexing behavior is applied to. Known values are: + "String", "Number", "Point", "Polygon", "LineString", "MultiPolygon". Default value: "String". + :vartype data_type: str or ~azure.mgmt.cosmosdb.models.DataType + :ivar precision: The precision of the index. -1 is maximum precision. + :vartype precision: int + :ivar kind: Indicates the type of index. Known values are: "Hash", "Range", "Spatial". Default + value: "Hash". + :vartype kind: str or ~azure.mgmt.cosmosdb.models.IndexKind """ - _validation = { - 'id': {'required': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'shard_key': {'key': 'shardKey', 'type': '{str}'}, - 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, - 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'int'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'precision': {'key': 'precision', 'type': 'int'}, + 'kind': {'key': 'kind', 'type': 'str'}, } def __init__( self, *, - id: str, - shard_key: Optional[Dict[str, str]] = None, - indexes: Optional[List["MongoIndex"]] = None, - analytical_storage_ttl: Optional[int] = None, + data_type: Optional[Union[str, "_models.DataType"]] = "String", + precision: Optional[int] = None, + kind: Optional[Union[str, "_models.IndexKind"]] = "Hash", **kwargs ): """ - :keyword id: Required. Name of the Cosmos DB MongoDB collection. - :paramtype id: str - :keyword shard_key: A key-value pair of shard keys to be applied for the request. - :paramtype shard_key: dict[str, str] - :keyword indexes: List of index keys. - :paramtype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] - :keyword analytical_storage_ttl: Analytical TTL. - :paramtype analytical_storage_ttl: int + :keyword data_type: The datatype for which the indexing behavior is applied to. Known values + are: "String", "Number", "Point", "Polygon", "LineString", "MultiPolygon". Default value: + "String". + :paramtype data_type: str or ~azure.mgmt.cosmosdb.models.DataType + :keyword precision: The precision of the index. -1 is maximum precision. + :paramtype precision: int + :keyword kind: Indicates the type of index. Known values are: "Hash", "Range", "Spatial". + Default value: "Hash". + :paramtype kind: str or ~azure.mgmt.cosmosdb.models.IndexKind """ - super(MongoDBCollectionResource, self).__init__(**kwargs) - self.id = id - self.shard_key = shard_key - self.indexes = indexes - self.analytical_storage_ttl = analytical_storage_ttl - - -class MongoDBCollectionGetPropertiesResource(ExtendedResourceProperties, MongoDBCollectionResource): - """MongoDBCollectionGetPropertiesResource. + super(Indexes, self).__init__(**kwargs) + self.data_type = data_type + self.precision = precision + self.kind = kind - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class IndexingPolicy(msrest.serialization.Model): + """Cosmos DB indexing policy. - :ivar id: Required. Name of the Cosmos DB MongoDB collection. - :vartype id: str - :ivar shard_key: A key-value pair of shard keys to be applied for the request. - :vartype shard_key: dict[str, str] - :ivar indexes: List of index keys. - :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] - :ivar analytical_storage_ttl: Analytical TTL. - :vartype analytical_storage_ttl: int - :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: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str + :ivar automatic: Indicates if the indexing policy is automatic. + :vartype automatic: bool + :ivar indexing_mode: Indicates the indexing mode. Known values are: "consistent", "lazy", + "none". Default value: "consistent". + :vartype indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode + :ivar included_paths: List of paths to include in the indexing. + :vartype included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] + :ivar excluded_paths: List of paths to exclude from indexing. + :vartype excluded_paths: list[~azure.mgmt.cosmosdb.models.ExcludedPath] + :ivar composite_indexes: List of composite path list. + :vartype composite_indexes: list[list[~azure.mgmt.cosmosdb.models.CompositePath]] + :ivar spatial_indexes: List of spatial specifics. + :vartype spatial_indexes: list[~azure.mgmt.cosmosdb.models.SpatialSpec] """ - _validation = { - 'id': {'required': True}, - 'rid': {'readonly': True}, - 'ts': {'readonly': True}, - 'etag': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'shard_key': {'key': 'shardKey', 'type': '{str}'}, - 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, - 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'int'}, - 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'float'}, - 'etag': {'key': '_etag', 'type': 'str'}, + 'automatic': {'key': 'automatic', 'type': 'bool'}, + 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, + 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, + 'composite_indexes': {'key': 'compositeIndexes', 'type': '[[CompositePath]]'}, + 'spatial_indexes': {'key': 'spatialIndexes', 'type': '[SpatialSpec]'}, } def __init__( self, *, - id: str, - shard_key: Optional[Dict[str, str]] = None, - indexes: Optional[List["MongoIndex"]] = None, - analytical_storage_ttl: Optional[int] = None, + automatic: Optional[bool] = None, + indexing_mode: Optional[Union[str, "_models.IndexingMode"]] = "consistent", + included_paths: Optional[List["_models.IncludedPath"]] = None, + excluded_paths: Optional[List["_models.ExcludedPath"]] = None, + composite_indexes: Optional[List[List["_models.CompositePath"]]] = None, + spatial_indexes: Optional[List["_models.SpatialSpec"]] = None, **kwargs ): """ - :keyword id: Required. Name of the Cosmos DB MongoDB collection. - :paramtype id: str - :keyword shard_key: A key-value pair of shard keys to be applied for the request. - :paramtype shard_key: dict[str, str] - :keyword indexes: List of index keys. - :paramtype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] - :keyword analytical_storage_ttl: Analytical TTL. - :paramtype analytical_storage_ttl: int + :keyword automatic: Indicates if the indexing policy is automatic. + :paramtype automatic: bool + :keyword indexing_mode: Indicates the indexing mode. Known values are: "consistent", "lazy", + "none". Default value: "consistent". + :paramtype indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode + :keyword included_paths: List of paths to include in the indexing. + :paramtype included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] + :keyword excluded_paths: List of paths to exclude from indexing. + :paramtype excluded_paths: list[~azure.mgmt.cosmosdb.models.ExcludedPath] + :keyword composite_indexes: List of composite path list. + :paramtype composite_indexes: list[list[~azure.mgmt.cosmosdb.models.CompositePath]] + :keyword spatial_indexes: List of spatial specifics. + :paramtype spatial_indexes: list[~azure.mgmt.cosmosdb.models.SpatialSpec] """ - super(MongoDBCollectionGetPropertiesResource, self).__init__(id=id, shard_key=shard_key, indexes=indexes, analytical_storage_ttl=analytical_storage_ttl, **kwargs) - self.id = id - self.shard_key = shard_key - self.indexes = indexes - self.analytical_storage_ttl = analytical_storage_ttl - self.rid = None - self.ts = None - self.etag = None - + super(IndexingPolicy, self).__init__(**kwargs) + self.automatic = automatic + self.indexing_mode = indexing_mode + self.included_paths = included_paths + self.excluded_paths = excluded_paths + self.composite_indexes = composite_indexes + self.spatial_indexes = spatial_indexes -class MongoDBCollectionGetResults(ARMResourceProperties): - """An Azure Cosmos DB MongoDB collection. - Variables are only populated by the server, and will be ignored when sending a request. +class IpAddressOrRange(msrest.serialization.Model): + """IpAddressOrRange object. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesOptions + :ivar ip_address_or_range: A single IPv4 address or a single IPv4 address range in CIDR format. + Provided IPs must be well-formatted and cannot be contained in one of the following ranges: + 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by + the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. + :vartype ip_address_or_range: str """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } + _attribute_map = { + 'ip_address_or_range': {'key': 'ipAddressOrRange', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_address_or_range: Optional[str] = None, + **kwargs + ): + """ + :keyword ip_address_or_range: A single IPv4 address or a single IPv4 address range in CIDR + format. Provided IPs must be well-formatted and cannot be contained in one of the following + ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not + enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or + “23.40.210.0/8”. + :paramtype ip_address_or_range: str + """ + super(IpAddressOrRange, self).__init__(**kwargs) + self.ip_address_or_range = ip_address_or_range + + +class ListClusters(msrest.serialization.Model): + """List of managed Cassandra clusters. + + :ivar value: Container for the array of clusters. + :vartype value: list[~azure.mgmt.cosmosdb.models.ClusterResource] + """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionGetPropertiesResource'}, - 'options': {'key': 'properties.options', 'type': 'MongoDBCollectionGetPropertiesOptions'}, + 'value': {'key': 'value', 'type': '[ClusterResource]'}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["MongoDBCollectionGetPropertiesResource"] = None, - options: Optional["MongoDBCollectionGetPropertiesOptions"] = None, + value: Optional[List["_models.ClusterResource"]] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesOptions + :keyword value: Container for the array of clusters. + :paramtype value: list[~azure.mgmt.cosmosdb.models.ClusterResource] """ - super(MongoDBCollectionGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options + super(ListClusters, self).__init__(**kwargs) + self.value = value -class MongoDBCollectionListResult(msrest.serialization.Model): - """The List operation response, that contains the MongoDB collections and their properties. +class ListDataCenters(msrest.serialization.Model): + """List of managed Cassandra data centers and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of MongoDB collections and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :ivar value: Container for array of data centers. + :vartype value: list[~azure.mgmt.cosmosdb.models.DataCenterResource] """ _validation = { @@ -7950,7 +5110,7 @@ class MongoDBCollectionListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[MongoDBCollectionGetResults]'}, + 'value': {'key': 'value', 'type': '[DataCenterResource]'}, } def __init__( @@ -7959,555 +5119,538 @@ def __init__( ): """ """ - super(MongoDBCollectionListResult, self).__init__(**kwargs) + super(ListDataCenters, self).__init__(**kwargs) self.value = None -class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB MongoDB database. +class Location(msrest.serialization.Model): + """A region in which the Azure Cosmos DB database account is deployed. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the ARM resource. + :ivar id: The unique identifier of the region within the database account. Example: + <accountName>-<locationName>. :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: Required. The standard JSON format of a MongoDB database. - :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseResource - :ivar options: A key-value pair of options to be applied for the request. This corresponds to - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :ivar location_name: The name of the region. + :vartype location_name: str + :ivar document_endpoint: The connection endpoint for the specific region. Example: + https://<accountName>-<locationName>.documents.azure.com:443/. + :vartype document_endpoint: str + :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 + the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is + active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB + account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – + the Cosmos DB account deletion failed. + :vartype provisioning_state: str + :ivar failover_priority: The failover priority of the region. A failover priority of 0 + indicates a write region. The maximum value for a failover priority = (total number of regions + - 1). Failover priority values must be unique for each of the regions in which the database + account exists. + :vartype failover_priority: int + :ivar is_zone_redundant: Flag to indicate whether or not this region is an AvailabilityZone + region. + :vartype is_zone_redundant: bool """ _validation = { 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource': {'required': True}, + 'document_endpoint': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'failover_priority': {'minimum': 0}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, - 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'document_endpoint': {'key': 'documentEndpoint', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + 'is_zone_redundant': {'key': 'isZoneRedundant', 'type': 'bool'}, } def __init__( self, *, - resource: "MongoDBDatabaseResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + location_name: Optional[str] = None, + failover_priority: Optional[int] = None, + is_zone_redundant: Optional[bool] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: Required. The standard JSON format of a MongoDB database. - :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseResource - :keyword options: A key-value pair of options to be applied for the request. This corresponds - to the headers sent with the request. - :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :keyword location_name: The name of the region. + :paramtype location_name: str + :keyword failover_priority: The failover priority of the region. A failover priority of 0 + indicates a write region. The maximum value for a failover priority = (total number of regions + - 1). Failover priority values must be unique for each of the regions in which the database + account exists. + :paramtype failover_priority: int + :keyword is_zone_redundant: Flag to indicate whether or not this region is an AvailabilityZone + region. + :paramtype is_zone_redundant: bool """ - super(MongoDBDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options + super(Location, self).__init__(**kwargs) + self.id = None + self.location_name = location_name + self.document_endpoint = None + self.provisioning_state = None + self.failover_priority = failover_priority + self.is_zone_redundant = is_zone_redundant -class MongoDBDatabaseGetPropertiesOptions(OptionsResource): - """MongoDBDatabaseGetPropertiesOptions. +class LocationGetResult(ARMProxyResource): + """Cosmos DB location get result. - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar properties: Cosmos DB location metadata. + :vartype properties: ~azure.mgmt.cosmosdb.models.LocationProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + _attribute_map = { - 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'LocationProperties'}, } def __init__( self, *, - throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, + properties: Optional["_models.LocationProperties"] = None, **kwargs ): """ - :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :paramtype throughput: int - :keyword autoscale_settings: Specifies the Autoscale settings. - :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + :keyword properties: Cosmos DB location metadata. + :paramtype properties: ~azure.mgmt.cosmosdb.models.LocationProperties """ - super(MongoDBDatabaseGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) + super(LocationGetResult, self).__init__(**kwargs) + self.properties = properties -class MongoDBDatabaseResource(msrest.serialization.Model): - """Cosmos DB MongoDB database resource object. +class LocationListResult(msrest.serialization.Model): + """The List operation response, that contains Cosmos DB locations and their properties. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Required. Name of the Cosmos DB MongoDB database. - :vartype id: str + :ivar value: List of Cosmos DB locations and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.LocationGetResult] """ _validation = { - 'id': {'required': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[LocationGetResult]'}, } def __init__( self, - *, - id: str, **kwargs ): """ - :keyword id: Required. Name of the Cosmos DB MongoDB database. - :paramtype id: str """ - super(MongoDBDatabaseResource, self).__init__(**kwargs) - self.id = id - - -class MongoDBDatabaseGetPropertiesResource(ExtendedResourceProperties, MongoDBDatabaseResource): - """MongoDBDatabaseGetPropertiesResource. - - 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: Required. Name of the Cosmos DB MongoDB database. - :vartype id: str - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str + super(LocationListResult, self).__init__(**kwargs) + self.value = None + + +class LocationProperties(msrest.serialization.Model): + """Cosmos DB location metadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar supports_availability_zone: Flag indicating whether the location supports availability + zones or not. + :vartype supports_availability_zone: bool + :ivar is_residency_restricted: Flag indicating whether the location is residency sensitive. + :vartype is_residency_restricted: bool + :ivar backup_storage_redundancies: The properties of available backup storage redundancies. + :vartype backup_storage_redundancies: list[str or + ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy] """ _validation = { - 'id': {'required': True}, - 'rid': {'readonly': True}, - 'ts': {'readonly': True}, - 'etag': {'readonly': True}, + 'supports_availability_zone': {'readonly': True}, + 'is_residency_restricted': {'readonly': True}, + 'backup_storage_redundancies': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'rid': {'key': '_rid', 'type': 'str'}, - 'ts': {'key': '_ts', 'type': 'float'}, - 'etag': {'key': '_etag', 'type': 'str'}, + 'supports_availability_zone': {'key': 'supportsAvailabilityZone', 'type': 'bool'}, + 'is_residency_restricted': {'key': 'isResidencyRestricted', 'type': 'bool'}, + 'backup_storage_redundancies': {'key': 'backupStorageRedundancies', 'type': '[str]'}, } def __init__( self, - *, - id: str, **kwargs ): """ - :keyword id: Required. Name of the Cosmos DB MongoDB database. - :paramtype id: str """ - super(MongoDBDatabaseGetPropertiesResource, self).__init__(id=id, **kwargs) - self.id = id - self.rid = None - self.ts = None - self.etag = None + super(LocationProperties, self).__init__(**kwargs) + self.supports_availability_zone = None + self.is_residency_restricted = None + self.backup_storage_redundancies = None -class MongoDBDatabaseGetResults(ARMResourceProperties): - """An Azure Cosmos DB MongoDB database. +class ManagedCassandraManagedServiceIdentity(msrest.serialization.Model): + """Identity for the resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesOptions + :ivar principal_id: The object id of the identity resource. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the resource. + :vartype tenant_id: str + :ivar type: The type of the resource. Known values are: "SystemAssigned", "None". + :vartype type: str or ~azure.mgmt.cosmosdb.models.ManagedCassandraResourceIdentityType """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseGetPropertiesResource'}, - 'options': {'key': 'properties.options', 'type': 'MongoDBDatabaseGetPropertiesOptions'}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["MongoDBDatabaseGetPropertiesResource"] = None, - options: Optional["MongoDBDatabaseGetPropertiesOptions"] = None, + type: Optional[Union[str, "_models.ManagedCassandraResourceIdentityType"]] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesOptions + :keyword type: The type of the resource. Known values are: "SystemAssigned", "None". + :paramtype type: str or ~azure.mgmt.cosmosdb.models.ManagedCassandraResourceIdentityType """ - super(MongoDBDatabaseGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options - + super(ManagedCassandraManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type -class MongoDBDatabaseListResult(msrest.serialization.Model): - """The List operation response, that contains the MongoDB databases and their properties. - Variables are only populated by the server, and will be ignored when sending a request. +class ManagedCassandraReaperStatus(msrest.serialization.Model): + """ManagedCassandraReaperStatus. - :ivar value: List of MongoDB databases and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :ivar healthy: + :vartype healthy: bool + :ivar repair_run_ids: Dictionary of :code:``. + :vartype repair_run_ids: dict[str, str] + :ivar repair_schedules: Dictionary of :code:``. + :vartype repair_schedules: dict[str, str] """ - _validation = { - 'value': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[MongoDBDatabaseGetResults]'}, + 'healthy': {'key': 'healthy', 'type': 'bool'}, + 'repair_run_ids': {'key': 'repairRunIds', 'type': '{str}'}, + 'repair_schedules': {'key': 'repairSchedules', 'type': '{str}'}, } def __init__( self, + *, + healthy: Optional[bool] = None, + repair_run_ids: Optional[Dict[str, str]] = None, + repair_schedules: Optional[Dict[str, str]] = None, **kwargs ): """ + :keyword healthy: + :paramtype healthy: bool + :keyword repair_run_ids: Dictionary of :code:``. + :paramtype repair_run_ids: dict[str, str] + :keyword repair_schedules: Dictionary of :code:``. + :paramtype repair_schedules: dict[str, str] """ - super(MongoDBDatabaseListResult, self).__init__(**kwargs) - self.value = None + super(ManagedCassandraReaperStatus, self).__init__(**kwargs) + self.healthy = healthy + self.repair_run_ids = repair_run_ids + self.repair_schedules = repair_schedules -class MongoIndex(msrest.serialization.Model): - """Cosmos DB MongoDB collection index key. +class ManagedServiceIdentity(msrest.serialization.Model): + """Identity for the resource. - :ivar key: Cosmos DB MongoDB collection index keys. - :vartype key: ~azure.mgmt.cosmosdb.models.MongoIndexKeys - :ivar options: Cosmos DB MongoDB collection index key options. - :vartype options: ~azure.mgmt.cosmosdb.models.MongoIndexOptions + 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 + :ivar 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. Known values are: "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned", "None". + :vartype type: str or ~azure.mgmt.cosmosdb.models.ResourceIdentityType + :ivar 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}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.cosmosdb.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] """ + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + _attribute_map = { - 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, - 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, + '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, *, - key: Optional["MongoIndexKeys"] = None, - options: Optional["MongoIndexOptions"] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, **kwargs ): """ - :keyword key: Cosmos DB MongoDB collection index keys. - :paramtype key: ~azure.mgmt.cosmosdb.models.MongoIndexKeys - :keyword options: Cosmos DB MongoDB collection index key options. - :paramtype options: ~azure.mgmt.cosmosdb.models.MongoIndexOptions + :keyword 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. Known values + are: "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.cosmosdb.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.cosmosdb.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] """ - super(MongoIndex, self).__init__(**kwargs) - self.key = key - self.options = options + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities -class MongoIndexKeys(msrest.serialization.Model): - """Cosmos DB MongoDB collection resource object. +class MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): + """Resource for a regional service location. - :ivar keys: List of keys for each MongoDB collection in the Azure Cosmos DB service. - :vartype keys: list[str] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The regional service name. + :vartype name: str + :ivar location: The location name. + :vartype location: str + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". + :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus """ + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + 'status': {'readonly': True}, + } + _attribute_map = { - 'keys': {'key': 'keys', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, } def __init__( self, - *, - keys: Optional[List[str]] = None, **kwargs ): """ - :keyword keys: List of keys for each MongoDB collection in the Azure Cosmos DB service. - :paramtype keys: list[str] """ - super(MongoIndexKeys, self).__init__(**kwargs) - self.keys = keys + super(MaterializedViewsBuilderRegionalServiceResource, self).__init__(**kwargs) -class MongoIndexOptions(msrest.serialization.Model): - """Cosmos DB MongoDB collection index options. +class MaterializedViewsBuilderServiceResource(msrest.serialization.Model): + """Describes the service response property for MaterializedViewsBuilder. - :ivar expire_after_seconds: Expire after seconds. - :vartype expire_after_seconds: int - :ivar unique: Is unique or not. - :vartype unique: bool + :ivar properties: Properties for MaterializedViewsBuilderServiceResource. + :vartype properties: + ~azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceProperties """ _attribute_map = { - 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, - 'unique': {'key': 'unique', 'type': 'bool'}, + 'properties': {'key': 'properties', 'type': 'MaterializedViewsBuilderServiceResourceProperties'}, } def __init__( self, *, - expire_after_seconds: Optional[int] = None, - unique: Optional[bool] = None, + properties: Optional["_models.MaterializedViewsBuilderServiceResourceProperties"] = None, **kwargs ): """ - :keyword expire_after_seconds: Expire after seconds. - :paramtype expire_after_seconds: int - :keyword unique: Is unique or not. - :paramtype unique: bool - """ - super(MongoIndexOptions, self).__init__(**kwargs) - self.expire_after_seconds = expire_after_seconds - self.unique = unique + :keyword properties: Properties for MaterializedViewsBuilderServiceResource. + :paramtype properties: + ~azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceProperties + """ + super(MaterializedViewsBuilderServiceResource, self).__init__(**kwargs) + self.properties = properties -class MongoRoleDefinitionCreateUpdateParameters(msrest.serialization.Model): - """Parameters to create and update an Azure Cosmos DB Mongo Role Definition. +class MaterializedViewsBuilderServiceResourceProperties(ServiceResourceProperties): + """Properties for MaterializedViewsBuilderServiceResource. - :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database - account. - :vartype role_name: str - :ivar type: Indicates whether the Role Definition was built-in or user created. Possible values - include: "BuiltInRole", "CustomRole". - :vartype type: str or ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionType - :ivar database_name: The database name for which access is being granted for this Role - Definition. - :vartype database_name: str - :ivar privileges: A set of privileges contained by the Role Definition. This will allow - application of this Role Definition on the entire database account or any underlying Database / - Collection. Scopes higher than Database are not enforceable as privilege. - :vartype privileges: list[~azure.mgmt.cosmosdb.models.Privilege] - :ivar roles: The set of roles inherited by this Role Definition. - :vartype roles: list[~azure.mgmt.cosmosdb.models.Role] + 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 additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar creation_time: Time of the last state change (ISO-8601 format). + :vartype creation_time: ~datetime.datetime + :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", "Cosmos.D16s". + :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize + :ivar instance_count: Instance count for the service. + :vartype instance_count: int + :ivar service_type: Required. ServiceType for the service.Constant filled by server. Known + values are: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", + "MaterializedViewsBuilder". + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". + :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus + :ivar locations: An array that contains all of the locations for the service. + :vartype locations: + list[~azure.mgmt.cosmosdb.models.MaterializedViewsBuilderRegionalServiceResource] """ + _validation = { + 'creation_time': {'readonly': True}, + 'instance_count': {'minimum': 0}, + 'service_type': {'required': True}, + 'status': {'readonly': True}, + 'locations': {'readonly': True}, + } + _attribute_map = { - 'role_name': {'key': 'properties.roleName', 'type': 'str'}, - 'type': {'key': 'properties.type', 'type': 'str'}, - 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, - 'privileges': {'key': 'properties.privileges', 'type': '[Privilege]'}, - 'roles': {'key': 'properties.roles', 'type': '[Role]'}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, + 'instance_size': {'key': 'instanceSize', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + 'service_type': {'key': 'serviceType', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[MaterializedViewsBuilderRegionalServiceResource]'}, } def __init__( self, *, - role_name: Optional[str] = None, - type: Optional[Union[str, "MongoRoleDefinitionType"]] = None, - database_name: Optional[str] = None, - privileges: Optional[List["Privilege"]] = None, - roles: Optional[List["Role"]] = None, + additional_properties: Optional[Dict[str, Any]] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, **kwargs ): """ - :keyword role_name: A user-friendly name for the Role Definition. Must be unique for the - database account. - :paramtype role_name: str - :keyword type: Indicates whether the Role Definition was built-in or user created. Possible - values include: "BuiltInRole", "CustomRole". - :paramtype type: str or ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionType - :keyword database_name: The database name for which access is being granted for this Role - Definition. - :paramtype database_name: str - :keyword privileges: A set of privileges contained by the Role Definition. This will allow - application of this Role Definition on the entire database account or any underlying Database / - Collection. Scopes higher than Database are not enforceable as privilege. - :paramtype privileges: list[~azure.mgmt.cosmosdb.models.Privilege] - :keyword roles: The set of roles inherited by this Role Definition. - :paramtype roles: list[~azure.mgmt.cosmosdb.models.Role] - """ - super(MongoRoleDefinitionCreateUpdateParameters, self).__init__(**kwargs) - self.role_name = role_name - self.type = type - self.database_name = database_name - self.privileges = privileges - self.roles = roles + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", "Cosmos.D16s". + :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize + :keyword instance_count: Instance count for the service. + :paramtype instance_count: int + """ + super(MaterializedViewsBuilderServiceResourceProperties, self).__init__(additional_properties=additional_properties, instance_size=instance_size, instance_count=instance_count, **kwargs) + self.service_type = 'MaterializedViewsBuilder' # type: str + self.locations = None -class MongoRoleDefinitionGetResults(ARMProxyResource): - """An Azure Cosmos DB Mongo Role Definition. +class Metric(msrest.serialization.Model): + """Metric data. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database - account. - :vartype role_name: str - :ivar type_properties_type: Indicates whether the Role Definition was built-in or user created. - Possible values include: "BuiltInRole", "CustomRole". - :vartype type_properties_type: str or ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionType - :ivar database_name: The database name for which access is being granted for this Role - Definition. - :vartype database_name: str - :ivar privileges: A set of privileges contained by the Role Definition. This will allow - application of this Role Definition on the entire database account or any underlying Database / - Collection. Scopes higher than Database are not enforceable as privilege. - :vartype privileges: list[~azure.mgmt.cosmosdb.models.Privilege] - :ivar roles: The set of roles inherited by this Role Definition. - :vartype roles: list[~azure.mgmt.cosmosdb.models.Role] + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: ~datetime.datetime + :ivar time_grain: The time grain to be used to summarize the metric values. + :vartype time_grain: str + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar metric_values: The metric values for the specified time window and timestep. + :vartype metric_values: list[~azure.mgmt.cosmosdb.models.MetricValue] """ _validation = { - 'id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'unit': {'readonly': True}, 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'metric_values': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'role_name': {'key': 'properties.roleName', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, - 'privileges': {'key': 'properties.privileges', 'type': '[Privilege]'}, - 'roles': {'key': 'properties.roles', 'type': '[Role]'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, } def __init__( self, - *, - role_name: Optional[str] = None, - type_properties_type: Optional[Union[str, "MongoRoleDefinitionType"]] = None, - database_name: Optional[str] = None, - privileges: Optional[List["Privilege"]] = None, - roles: Optional[List["Role"]] = None, **kwargs ): """ - :keyword role_name: A user-friendly name for the Role Definition. Must be unique for the - database account. - :paramtype role_name: str - :keyword type_properties_type: Indicates whether the Role Definition was built-in or user - created. Possible values include: "BuiltInRole", "CustomRole". - :paramtype type_properties_type: str or ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionType - :keyword database_name: The database name for which access is being granted for this Role - Definition. - :paramtype database_name: str - :keyword privileges: A set of privileges contained by the Role Definition. This will allow - application of this Role Definition on the entire database account or any underlying Database / - Collection. Scopes higher than Database are not enforceable as privilege. - :paramtype privileges: list[~azure.mgmt.cosmosdb.models.Privilege] - :keyword roles: The set of roles inherited by this Role Definition. - :paramtype roles: list[~azure.mgmt.cosmosdb.models.Role] - """ - super(MongoRoleDefinitionGetResults, self).__init__(**kwargs) - self.role_name = role_name - self.type_properties_type = type_properties_type - self.database_name = database_name - self.privileges = privileges - self.roles = roles + """ + super(Metric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = None + self.name = None + self.metric_values = None -class MongoRoleDefinitionListResult(msrest.serialization.Model): - """The relevant Mongo Role Definitions. +class MetricAvailability(msrest.serialization.Model): + """The availability of the metric. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Mongo Role Definitions and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + :ivar time_grain: The time grain to be used to summarize the metric values. + :vartype time_grain: str + :ivar retention: The retention for the metric values. + :vartype retention: str """ _validation = { - 'value': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'retention': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MongoRoleDefinitionGetResults]'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'retention': {'key': 'retention', 'type': 'str'}, } def __init__( @@ -8516,162 +5659,94 @@ def __init__( ): """ """ - super(MongoRoleDefinitionListResult, self).__init__(**kwargs) - self.value = None + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = None + self.retention = None -class MongoUserDefinitionCreateUpdateParameters(msrest.serialization.Model): - """Parameters to create and update an Azure Cosmos DB Mongo User Definition. +class MetricDefinition(msrest.serialization.Model): + """The definition of a metric. - :ivar user_name: The user name for User Definition. - :vartype user_name: str - :ivar password: The password for User Definition. Response does not contain user password. - :vartype password: str - :ivar database_name: The database name for which access is being granted for this User - Definition. - :vartype database_name: str - :ivar custom_data: A custom definition for the USer Definition. - :vartype custom_data: str - :ivar roles: The set of roles inherited by the User Definition. - :vartype roles: list[~azure.mgmt.cosmosdb.models.Role] - :ivar mechanisms: The Mongo Auth mechanism. For now, we only support auth mechanism - SCRAM-SHA-256. - :vartype mechanisms: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar metric_availabilities: The list of metric availabilities for the account. + :vartype metric_availabilities: list[~azure.mgmt.cosmosdb.models.MetricAvailability] + :ivar primary_aggregation_type: The primary aggregation type of the metric. Known values are: + "None", "Average", "Total", "Minimum", "Maximum", "Last". + :vartype primary_aggregation_type: str or ~azure.mgmt.cosmosdb.models.PrimaryAggregationType + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar resource_uri: The resource uri of the database. + :vartype resource_uri: str + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName """ + _validation = { + 'metric_availabilities': {'readonly': True}, + 'primary_aggregation_type': {'readonly': True}, + 'unit': {'readonly': True}, + 'resource_uri': {'readonly': True}, + 'name': {'readonly': True}, + } + _attribute_map = { - 'user_name': {'key': 'properties.userName', 'type': 'str'}, - 'password': {'key': 'properties.password', 'type': 'str'}, - 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, - 'custom_data': {'key': 'properties.customData', 'type': 'str'}, - 'roles': {'key': 'properties.roles', 'type': '[Role]'}, - 'mechanisms': {'key': 'properties.mechanisms', 'type': 'str'}, + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, } def __init__( self, - *, - user_name: Optional[str] = None, - password: Optional[str] = None, - database_name: Optional[str] = None, - custom_data: Optional[str] = None, - roles: Optional[List["Role"]] = None, - mechanisms: Optional[str] = None, **kwargs ): """ - :keyword user_name: The user name for User Definition. - :paramtype user_name: str - :keyword password: The password for User Definition. Response does not contain user password. - :paramtype password: str - :keyword database_name: The database name for which access is being granted for this User - Definition. - :paramtype database_name: str - :keyword custom_data: A custom definition for the USer Definition. - :paramtype custom_data: str - :keyword roles: The set of roles inherited by the User Definition. - :paramtype roles: list[~azure.mgmt.cosmosdb.models.Role] - :keyword mechanisms: The Mongo Auth mechanism. For now, we only support auth mechanism - SCRAM-SHA-256. - :paramtype mechanisms: str - """ - super(MongoUserDefinitionCreateUpdateParameters, self).__init__(**kwargs) - self.user_name = user_name - self.password = password - self.database_name = database_name - self.custom_data = custom_data - self.roles = roles - self.mechanisms = mechanisms + """ + super(MetricDefinition, self).__init__(**kwargs) + self.metric_availabilities = None + self.primary_aggregation_type = None + self.unit = None + self.resource_uri = None + self.name = None -class MongoUserDefinitionGetResults(ARMProxyResource): - """An Azure Cosmos DB User Definition. +class MetricDefinitionsListResult(msrest.serialization.Model): + """The response to a list metric definitions request. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar user_name: The user name for User Definition. - :vartype user_name: str - :ivar password: The password for User Definition. Response does not contain user password. - :vartype password: str - :ivar database_name: The database name for which access is being granted for this User - Definition. - :vartype database_name: str - :ivar custom_data: A custom definition for the USer Definition. - :vartype custom_data: str - :ivar roles: The set of roles inherited by the User Definition. - :vartype roles: list[~azure.mgmt.cosmosdb.models.Role] - :ivar mechanisms: The Mongo Auth mechanism. For now, we only support auth mechanism - SCRAM-SHA-256. - :vartype mechanisms: str + :ivar value: The list of metric definitions for the account. + :vartype value: list[~azure.mgmt.cosmosdb.models.MetricDefinition] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_name': {'key': 'properties.userName', 'type': 'str'}, - 'password': {'key': 'properties.password', 'type': 'str'}, - 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, - 'custom_data': {'key': 'properties.customData', 'type': 'str'}, - 'roles': {'key': 'properties.roles', 'type': '[Role]'}, - 'mechanisms': {'key': 'properties.mechanisms', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[MetricDefinition]'}, } def __init__( self, - *, - user_name: Optional[str] = None, - password: Optional[str] = None, - database_name: Optional[str] = None, - custom_data: Optional[str] = None, - roles: Optional[List["Role"]] = None, - mechanisms: Optional[str] = None, **kwargs ): """ - :keyword user_name: The user name for User Definition. - :paramtype user_name: str - :keyword password: The password for User Definition. Response does not contain user password. - :paramtype password: str - :keyword database_name: The database name for which access is being granted for this User - Definition. - :paramtype database_name: str - :keyword custom_data: A custom definition for the USer Definition. - :paramtype custom_data: str - :keyword roles: The set of roles inherited by the User Definition. - :paramtype roles: list[~azure.mgmt.cosmosdb.models.Role] - :keyword mechanisms: The Mongo Auth mechanism. For now, we only support auth mechanism - SCRAM-SHA-256. - :paramtype mechanisms: str - """ - super(MongoUserDefinitionGetResults, self).__init__(**kwargs) - self.user_name = user_name - self.password = password - self.database_name = database_name - self.custom_data = custom_data - self.roles = roles - self.mechanisms = mechanisms + """ + super(MetricDefinitionsListResult, self).__init__(**kwargs) + self.value = None -class MongoUserDefinitionListResult(msrest.serialization.Model): - """The relevant User Definition. +class MetricListResult(msrest.serialization.Model): + """The response to a list metrics request. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of User Definition and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + :ivar value: The list of metrics for the account. + :vartype value: list[~azure.mgmt.cosmosdb.models.Metric] """ _validation = { @@ -8679,7 +5754,7 @@ class MongoUserDefinitionListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[MongoUserDefinitionGetResults]'}, + 'value': {'key': 'value', 'type': '[Metric]'}, } def __init__( @@ -8688,75 +5763,77 @@ def __init__( ): """ """ - super(MongoUserDefinitionListResult, self).__init__(**kwargs) + super(MetricListResult, self).__init__(**kwargs) self.value = None -class NotebookWorkspace(ARMProxyResource): - """A notebook workspace resource. +class MetricName(msrest.serialization.Model): + """A metric name. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. - :vartype notebook_server_endpoint: str - :ivar status: Status of the notebook workspace. Possible values are: Creating, Online, - Deleting, Failed, Updating. - :vartype status: str + :ivar value: The name of the metric. + :vartype value: str + :ivar localized_value: The friendly name of the metric. + :vartype localized_value: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'notebook_server_endpoint': {'readonly': True}, - 'status': {'readonly': True}, + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'notebook_server_endpoint': {'key': 'properties.notebookServerEndpoint', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } def __init__( self, **kwargs ): - """ - """ - super(NotebookWorkspace, self).__init__(**kwargs) - self.notebook_server_endpoint = None - self.status = None + """ + """ + super(MetricName, self).__init__(**kwargs) + self.value = None + self.localized_value = None -class NotebookWorkspaceConnectionInfoResult(msrest.serialization.Model): - """The connection info for the given notebook workspace. +class MetricValue(msrest.serialization.Model): + """Represents metrics values. Variables are only populated by the server, and will be ignored when sending a request. - :ivar auth_token: Specifies auth token used for connecting to Notebook server (uses token-based - auth). - :vartype auth_token: str - :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. - :vartype notebook_server_endpoint: str + :ivar count: The number of values for the metric. + :vartype count: int + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: ~datetime.datetime + :ivar total: The total value of the metric. + :vartype total: float """ _validation = { - 'auth_token': {'readonly': True}, - 'notebook_server_endpoint': {'readonly': True}, + 'count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, } _attribute_map = { - 'auth_token': {'key': 'authToken', 'type': 'str'}, - 'notebook_server_endpoint': {'key': 'notebookServerEndpoint', 'type': 'str'}, + 'count': {'key': '_count', 'type': 'int'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, } def __init__( @@ -8765,245 +5842,323 @@ def __init__( ): """ """ - super(NotebookWorkspaceConnectionInfoResult, self).__init__(**kwargs) - self.auth_token = None - self.notebook_server_endpoint = None + super(MetricValue, self).__init__(**kwargs) + self.count = None + self.average = None + self.maximum = None + self.minimum = None + self.timestamp = None + self.total = None -class NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): - """Parameters to create a notebook workspace resource. +class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB collection. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the database account. + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These + tags can be used in viewing and grouping this resource (across resource groups). A maximum of + 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters + and value no greater than 256 characters. For example, the default experience for a template + type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also + include "Table", "Graph", "DocumentDB", and "MongoDB". + :vartype tags: dict[str, str] + :ivar resource: Required. The standard JSON format of a MongoDB collection. + :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionResource + :ivar options: A key-value pair of options to be applied for the request. This corresponds to + the headers sent with the request. + :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'resource': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionResource'}, + 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } def __init__( self, + *, + resource: "_models.MongoDBCollectionResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword resource: Required. The standard JSON format of a MongoDB collection. + :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionResource + :keyword options: A key-value pair of options to be applied for the request. This corresponds + to the headers sent with the request. + :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(NotebookWorkspaceCreateUpdateParameters, self).__init__(**kwargs) + super(MongoDBCollectionCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options -class NotebookWorkspaceListResult(msrest.serialization.Model): - """A list of notebook workspace resources. +class MongoDBCollectionGetPropertiesOptions(OptionsResource): + """MongoDBCollectionGetPropertiesOptions. - :ivar value: Array of notebook workspace resources. - :vartype value: list[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + ThroughputSetting resource when retrieving offer details. + :vartype throughput: int + :ivar autoscale_settings: Specifies the Autoscale settings. + :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NotebookWorkspace]'}, + 'throughput': {'key': 'throughput', 'type': 'int'}, + 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, } def __init__( self, *, - value: Optional[List["NotebookWorkspace"]] = None, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, **kwargs ): """ - :keyword value: Array of notebook workspace resources. - :paramtype value: list[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + ThroughputSetting resource when retrieving offer details. + :paramtype throughput: int + :keyword autoscale_settings: Specifies the Autoscale settings. + :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings """ - super(NotebookWorkspaceListResult, self).__init__(**kwargs) - self.value = value + super(MongoDBCollectionGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) -class Operation(msrest.serialization.Model): - """REST API operation. +class MongoDBCollectionResource(msrest.serialization.Model): + """Cosmos DB MongoDB collection resource object. - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.cosmosdb.models.OperationDisplay + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Name of the Cosmos DB MongoDB collection. + :vartype id: str + :ivar shard_key: A key-value pair of shard keys to be applied for the request. + :vartype shard_key: dict[str, str] + :ivar indexes: List of index keys. + :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + :ivar analytical_storage_ttl: Analytical TTL. + :vartype analytical_storage_ttl: int """ - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + _validation = { + 'id': {'required': True}, } - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, - **kwargs - ): - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.cosmosdb.models.OperationDisplay - """ - super(Operation, self).__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - :ivar provider: Service provider: Microsoft.ResourceProvider. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - :ivar description: Description of operation. - :vartype description: str - """ - _attribute_map = { - 'provider': {'key': 'Provider', 'type': 'str'}, - 'resource': {'key': 'Resource', 'type': 'str'}, - 'operation': {'key': 'Operation', 'type': 'str'}, - 'description': {'key': 'Description', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'int'}, } def __init__( self, *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, + id: str, + shard_key: Optional[Dict[str, str]] = None, + indexes: Optional[List["_models.MongoIndex"]] = None, + analytical_storage_ttl: Optional[int] = None, **kwargs ): """ - :keyword provider: Service provider: Microsoft.ResourceProvider. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed: Profile, endpoint, etc. - :paramtype resource: str - :keyword operation: Operation type: Read, write, delete, etc. - :paramtype operation: str - :keyword description: Description of operation. - :paramtype description: str + :keyword id: Required. Name of the Cosmos DB MongoDB collection. + :paramtype id: str + :keyword shard_key: A key-value pair of shard keys to be applied for the request. + :paramtype shard_key: dict[str, str] + :keyword indexes: List of index keys. + :paramtype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + :keyword analytical_storage_ttl: Analytical TTL. + :paramtype analytical_storage_ttl: int """ - super(OperationDisplay, self).__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description + super(MongoDBCollectionResource, self).__init__(**kwargs) + self.id = id + self.shard_key = shard_key + self.indexes = indexes + self.analytical_storage_ttl = analytical_storage_ttl -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. +class MongoDBCollectionGetPropertiesResource(ExtendedResourceProperties, MongoDBCollectionResource): + """MongoDBCollectionGetPropertiesResource. - :ivar value: List of operations supported by the Resource Provider. - :vartype value: list[~azure.mgmt.cosmosdb.models.Operation] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str + 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: Required. Name of the Cosmos DB MongoDB collection. + :vartype id: str + :ivar shard_key: A key-value pair of shard keys to be applied for the request. + :vartype shard_key: dict[str, str] + :ivar indexes: List of index keys. + :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + :ivar analytical_storage_ttl: Analytical TTL. + :vartype analytical_storage_ttl: int + :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: float + :ivar etag: A system generated property representing the resource etag required for optimistic + concurrency control. + :vartype etag: str """ + _validation = { + 'id': {'required': True}, + 'rid': {'readonly': True}, + 'ts': {'readonly': True}, + 'etag': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'int'}, + 'rid': {'key': '_rid', 'type': 'str'}, + 'ts': {'key': '_ts', 'type': 'float'}, + 'etag': {'key': '_etag', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["Operation"]] = None, - next_link: Optional[str] = None, + id: str, + shard_key: Optional[Dict[str, str]] = None, + indexes: Optional[List["_models.MongoIndex"]] = None, + analytical_storage_ttl: Optional[int] = None, **kwargs ): """ - :keyword value: List of operations supported by the Resource Provider. - :paramtype value: list[~azure.mgmt.cosmosdb.models.Operation] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str + :keyword id: Required. Name of the Cosmos DB MongoDB collection. + :paramtype id: str + :keyword shard_key: A key-value pair of shard keys to be applied for the request. + :paramtype shard_key: dict[str, str] + :keyword indexes: List of index keys. + :paramtype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + :keyword analytical_storage_ttl: Analytical TTL. + :paramtype analytical_storage_ttl: int """ - super(OperationListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(MongoDBCollectionGetPropertiesResource, self).__init__(id=id, shard_key=shard_key, indexes=indexes, analytical_storage_ttl=analytical_storage_ttl, **kwargs) + self.id = id + self.shard_key = shard_key + self.indexes = indexes + self.analytical_storage_ttl = analytical_storage_ttl + self.rid = None + self.ts = None + self.etag = None -class PartitionMetric(Metric): - """The metric values for a single partition. +class MongoDBCollectionGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB collection. Variables are only populated by the server, and will be ignored when sending a request. - :ivar start_time: The start time for the metric (ISO-8601 format). - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time for the metric (ISO-8601 format). - :vartype end_time: ~datetime.datetime - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond", "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar metric_values: The metric values for the specified time window and timestep. - :vartype metric_values: list[~azure.mgmt.cosmosdb.models.MetricValue] - :ivar partition_id: The partition id (GUID identifier) of the metric values. - :vartype partition_id: str - :ivar partition_key_range_id: The partition key range id (integer identifier) of the metric - values. - :vartype partition_key_range_id: str + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These + tags can be used in viewing and grouping this resource (across resource groups). A maximum of + 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters + and value no greater than 256 characters. For example, the default experience for a template + type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also + include "Table", "Graph", "DocumentDB", and "MongoDB". + :vartype tags: dict[str, str] + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesOptions """ _validation = { - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'time_grain': {'readonly': True}, - 'unit': {'readonly': True}, + 'id': {'readonly': True}, 'name': {'readonly': True}, - 'metric_values': {'readonly': True}, - 'partition_id': {'readonly': True}, - 'partition_key_range_id': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'MetricName'}, - 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, - 'partition_id': {'key': 'partitionId', 'type': 'str'}, - 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBCollectionGetPropertiesResource'}, + 'options': {'key': 'properties.options', 'type': 'MongoDBCollectionGetPropertiesOptions'}, } def __init__( self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + resource: Optional["_models.MongoDBCollectionGetPropertiesResource"] = None, + options: Optional["_models.MongoDBCollectionGetPropertiesOptions"] = None, **kwargs ): """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword resource: + :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesResource + :keyword options: + :paramtype options: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesOptions """ - super(PartitionMetric, self).__init__(**kwargs) - self.partition_id = None - self.partition_key_range_id = None + super(MongoDBCollectionGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options -class PartitionMetricListResult(msrest.serialization.Model): - """The response to a list partition metrics request. +class MongoDBCollectionListResult(msrest.serialization.Model): + """The List operation response, that contains the MongoDB collections and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of partition-level metrics for the account. - :vartype value: list[~azure.mgmt.cosmosdb.models.PartitionMetric] + :ivar value: List of MongoDB collections and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] """ _validation = { @@ -9011,7 +6166,7 @@ class PartitionMetricListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[PartitionMetric]'}, + 'value': {'key': 'value', 'type': '[MongoDBCollectionGetResults]'}, } def __init__( @@ -9020,282 +6175,284 @@ def __init__( ): """ """ - super(PartitionMetricListResult, self).__init__(**kwargs) + super(MongoDBCollectionListResult, self).__init__(**kwargs) self.value = None -class Usage(msrest.serialization.Model): - """The usage data for a usage request. +class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB MongoDB database. Variables are only populated by the server, and will be ignored when sending a request. - :ivar unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond", "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar quota_period: The quota period used to summarize the usage values. - :vartype quota_period: str - :ivar limit: Maximum value for this metric. - :vartype limit: long - :ivar current_value: Current value for this metric. - :vartype current_value: long + All required parameters must be populated in order to send to Azure. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These + tags can be used in viewing and grouping this resource (across resource groups). A maximum of + 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters + and value no greater than 256 characters. For example, the default experience for a template + type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also + include "Table", "Graph", "DocumentDB", and "MongoDB". + :vartype tags: dict[str, str] + :ivar resource: Required. The standard JSON format of a MongoDB database. + :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseResource + :ivar options: A key-value pair of options to be applied for the request. This corresponds to + the headers sent with the request. + :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ _validation = { - 'unit': {'readonly': True}, + 'id': {'readonly': True}, 'name': {'readonly': True}, - 'quota_period': {'readonly': True}, - 'limit': {'readonly': True}, - 'current_value': {'readonly': True}, + 'type': {'readonly': True}, + 'resource': {'required': True}, } _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'MetricName'}, - 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } def __init__( self, + *, + resource: "_models.MongoDBDatabaseResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword resource: Required. The standard JSON format of a MongoDB database. + :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseResource + :keyword options: A key-value pair of options to be applied for the request. This corresponds + to the headers sent with the request. + :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(Usage, self).__init__(**kwargs) - self.unit = None - self.name = None - self.quota_period = None - self.limit = None - self.current_value = None - + super(MongoDBDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options -class PartitionUsage(Usage): - """The partition level usage data for a usage request. - Variables are only populated by the server, and will be ignored when sending a request. +class MongoDBDatabaseGetPropertiesOptions(OptionsResource): + """MongoDBDatabaseGetPropertiesOptions. - :ivar unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond", "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar quota_period: The quota period used to summarize the usage values. - :vartype quota_period: str - :ivar limit: Maximum value for this metric. - :vartype limit: long - :ivar current_value: Current value for this metric. - :vartype current_value: long - :ivar partition_id: The partition id (GUID identifier) of the usages. - :vartype partition_id: str - :ivar partition_key_range_id: The partition key range id (integer identifier) of the usages. - :vartype partition_key_range_id: str + :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + ThroughputSetting resource when retrieving offer details. + :vartype throughput: int + :ivar autoscale_settings: Specifies the Autoscale settings. + :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings """ - _validation = { - 'unit': {'readonly': True}, - 'name': {'readonly': True}, - 'quota_period': {'readonly': True}, - 'limit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'partition_id': {'readonly': True}, - 'partition_key_range_id': {'readonly': True}, - } - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'MetricName'}, - 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'partition_id': {'key': 'partitionId', 'type': 'str'}, - 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, + 'throughput': {'key': 'throughput', 'type': 'int'}, + 'autoscale_settings': {'key': 'autoscaleSettings', 'type': 'AutoscaleSettings'}, } def __init__( self, + *, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, **kwargs ): """ + :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + ThroughputSetting resource when retrieving offer details. + :paramtype throughput: int + :keyword autoscale_settings: Specifies the Autoscale settings. + :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings """ - super(PartitionUsage, self).__init__(**kwargs) - self.partition_id = None - self.partition_key_range_id = None + super(MongoDBDatabaseGetPropertiesOptions, self).__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) -class PartitionUsagesResult(msrest.serialization.Model): - """The response to a list partition level usage request. +class MongoDBDatabaseResource(msrest.serialization.Model): + """Cosmos DB MongoDB database resource object. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar value: The list of partition-level usages for the database. A usage is a point in time - metric. - :vartype value: list[~azure.mgmt.cosmosdb.models.PartitionUsage] + :ivar id: Required. Name of the Cosmos DB MongoDB database. + :vartype id: str """ _validation = { - 'value': {'readonly': True}, + 'id': {'required': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[PartitionUsage]'}, + 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, + *, + id: str, **kwargs ): """ + :keyword id: Required. Name of the Cosmos DB MongoDB database. + :paramtype id: str """ - super(PartitionUsagesResult, self).__init__(**kwargs) - self.value = None + super(MongoDBDatabaseResource, self).__init__(**kwargs) + self.id = id -class PercentileMetric(msrest.serialization.Model): - """Percentile Metric data. +class MongoDBDatabaseGetPropertiesResource(ExtendedResourceProperties, MongoDBDatabaseResource): + """MongoDBDatabaseGetPropertiesResource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar start_time: The start time for the metric (ISO-8601 format). - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time for the metric (ISO-8601 format). - :vartype end_time: ~datetime.datetime - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond", "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar metric_values: The percentile metric values for the specified time window and timestep. - :vartype metric_values: list[~azure.mgmt.cosmosdb.models.PercentileMetricValue] + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Name of the Cosmos DB MongoDB database. + :vartype id: str + :ivar rid: A system generated property. A unique identifier. + :vartype rid: str + :ivar ts: A system generated property that denotes the last updated timestamp of the resource. + :vartype ts: float + :ivar etag: A system generated property representing the resource etag required for optimistic + concurrency control. + :vartype etag: str """ _validation = { - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'time_grain': {'readonly': True}, - 'unit': {'readonly': True}, - 'name': {'readonly': True}, - 'metric_values': {'readonly': True}, + 'id': {'required': True}, + 'rid': {'readonly': True}, + 'ts': {'readonly': True}, + 'etag': {'readonly': True}, } _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'MetricName'}, - 'metric_values': {'key': 'metricValues', 'type': '[PercentileMetricValue]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'rid': {'key': '_rid', 'type': 'str'}, + 'ts': {'key': '_ts', 'type': 'float'}, + 'etag': {'key': '_etag', 'type': 'str'}, } def __init__( self, + *, + id: str, **kwargs ): """ + :keyword id: Required. Name of the Cosmos DB MongoDB database. + :paramtype id: str """ - super(PercentileMetric, self).__init__(**kwargs) - self.start_time = None - self.end_time = None - self.time_grain = None - self.unit = None - self.name = None - self.metric_values = None + super(MongoDBDatabaseGetPropertiesResource, self).__init__(id=id, **kwargs) + self.id = id + self.rid = None + self.ts = None + self.etag = None -class PercentileMetricListResult(msrest.serialization.Model): - """The response to a list percentile metrics request. +class MongoDBDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB MongoDB database. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of percentile metrics for the account. - :vartype value: list[~azure.mgmt.cosmosdb.models.PercentileMetric] + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These + tags can be used in viewing and grouping this resource (across resource groups). A maximum of + 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters + and value no greater than 256 characters. For example, the default experience for a template + type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also + include "Table", "Graph", "DocumentDB", and "MongoDB". + :vartype tags: dict[str, str] + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesOptions """ _validation = { - 'value': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[PercentileMetric]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'resource': {'key': 'properties.resource', 'type': 'MongoDBDatabaseGetPropertiesResource'}, + 'options': {'key': 'properties.options', 'type': 'MongoDBDatabaseGetPropertiesOptions'}, } def __init__( self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + resource: Optional["_models.MongoDBDatabaseGetPropertiesResource"] = None, + options: Optional["_models.MongoDBDatabaseGetPropertiesOptions"] = None, **kwargs ): """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 + characters and value no greater than 256 characters. For example, the default experience for a + template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values + also include "Table", "Graph", "DocumentDB", and "MongoDB". + :paramtype tags: dict[str, str] + :keyword resource: + :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesResource + :keyword options: + :paramtype options: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesOptions """ - super(PercentileMetricListResult, self).__init__(**kwargs) - self.value = None + super(MongoDBDatabaseGetResults, self).__init__(location=location, tags=tags, **kwargs) + self.resource = resource + self.options = options -class PercentileMetricValue(MetricValue): - """Represents percentile metrics values. +class MongoDBDatabaseListResult(msrest.serialization.Model): + """The List operation response, that contains the MongoDB databases and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar count: The number of values for the metric. - :vartype count: int - :ivar average: The average value of the metric. - :vartype average: float - :ivar maximum: The max value of the metric. - :vartype maximum: float - :ivar minimum: The min value of the metric. - :vartype minimum: float - :ivar timestamp: The metric timestamp (ISO-8601 format). - :vartype timestamp: ~datetime.datetime - :ivar total: The total value of the metric. - :vartype total: float - :ivar p10: The 10th percentile value for the metric. - :vartype p10: float - :ivar p25: The 25th percentile value for the metric. - :vartype p25: float - :ivar p50: The 50th percentile value for the metric. - :vartype p50: float - :ivar p75: The 75th percentile value for the metric. - :vartype p75: float - :ivar p90: The 90th percentile value for the metric. - :vartype p90: float - :ivar p95: The 95th percentile value for the metric. - :vartype p95: float - :ivar p99: The 99th percentile value for the metric. - :vartype p99: float + :ivar value: List of MongoDB databases and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] """ _validation = { - 'count': {'readonly': True}, - 'average': {'readonly': True}, - 'maximum': {'readonly': True}, - 'minimum': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'total': {'readonly': True}, - 'p10': {'readonly': True}, - 'p25': {'readonly': True}, - 'p50': {'readonly': True}, - 'p75': {'readonly': True}, - 'p90': {'readonly': True}, - 'p95': {'readonly': True}, - 'p99': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'count': {'key': '_count', 'type': 'int'}, - 'average': {'key': 'average', 'type': 'float'}, - 'maximum': {'key': 'maximum', 'type': 'float'}, - 'minimum': {'key': 'minimum', 'type': 'float'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'total': {'key': 'total', 'type': 'float'}, - 'p10': {'key': 'P10', 'type': 'float'}, - 'p25': {'key': 'P25', 'type': 'float'}, - 'p50': {'key': 'P50', 'type': 'float'}, - 'p75': {'key': 'P75', 'type': 'float'}, - 'p90': {'key': 'P90', 'type': 'float'}, - 'p95': {'key': 'P95', 'type': 'float'}, - 'p99': {'key': 'P99', 'type': 'float'}, + 'value': {'key': 'value', 'type': '[MongoDBDatabaseGetResults]'}, } def __init__( @@ -9304,193 +6461,164 @@ def __init__( ): """ """ - super(PercentileMetricValue, self).__init__(**kwargs) - self.p10 = None - self.p25 = None - self.p50 = None - self.p75 = None - self.p90 = None - self.p95 = None - self.p99 = None - + super(MongoDBDatabaseListResult, self).__init__(**kwargs) + self.value = None -class PeriodicModeBackupPolicy(BackupPolicy): - """The object representing periodic mode backup policy. - All required parameters must be populated in order to send to Azure. +class MongoIndex(msrest.serialization.Model): + """Cosmos DB MongoDB collection index key. - :ivar type: Required. Describes the mode of backups.Constant filled by server. Possible values - include: "Periodic", "Continuous". - :vartype type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType - :ivar migration_state: The object representing the state of the migration between the backup - policies. - :vartype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState - :ivar periodic_mode_properties: Configuration values for periodic mode backup. - :vartype periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties + :ivar key: Cosmos DB MongoDB collection index keys. + :vartype key: ~azure.mgmt.cosmosdb.models.MongoIndexKeys + :ivar options: Cosmos DB MongoDB collection index key options. + :vartype options: ~azure.mgmt.cosmosdb.models.MongoIndexOptions """ - _validation = { - 'type': {'required': True}, - } - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'migration_state': {'key': 'migrationState', 'type': 'BackupPolicyMigrationState'}, - 'periodic_mode_properties': {'key': 'periodicModeProperties', 'type': 'PeriodicModeProperties'}, + 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, + 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, } def __init__( self, *, - migration_state: Optional["BackupPolicyMigrationState"] = None, - periodic_mode_properties: Optional["PeriodicModeProperties"] = None, + key: Optional["_models.MongoIndexKeys"] = None, + options: Optional["_models.MongoIndexOptions"] = None, **kwargs ): """ - :keyword migration_state: The object representing the state of the migration between the backup - policies. - :paramtype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState - :keyword periodic_mode_properties: Configuration values for periodic mode backup. - :paramtype periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties + :keyword key: Cosmos DB MongoDB collection index keys. + :paramtype key: ~azure.mgmt.cosmosdb.models.MongoIndexKeys + :keyword options: Cosmos DB MongoDB collection index key options. + :paramtype options: ~azure.mgmt.cosmosdb.models.MongoIndexOptions """ - super(PeriodicModeBackupPolicy, self).__init__(migration_state=migration_state, **kwargs) - self.type = 'Periodic' # type: str - self.periodic_mode_properties = periodic_mode_properties + super(MongoIndex, self).__init__(**kwargs) + self.key = key + self.options = options -class PeriodicModeProperties(msrest.serialization.Model): - """Configuration values for periodic mode backup. +class MongoIndexKeys(msrest.serialization.Model): + """Cosmos DB MongoDB collection resource object. - :ivar backup_interval_in_minutes: An integer representing the interval in minutes between two - backups. - :vartype backup_interval_in_minutes: int - :ivar backup_retention_interval_in_hours: An integer representing the time (in hours) that each - backup is retained. - :vartype backup_retention_interval_in_hours: int - :ivar backup_storage_redundancy: Enum to indicate type of backup residency. Possible values - include: "Geo", "Local", "Zone". - :vartype backup_storage_redundancy: str or ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy + :ivar keys: List of keys for each MongoDB collection in the Azure Cosmos DB service. + :vartype keys: list[str] """ - _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'}, - 'backup_storage_redundancy': {'key': 'backupStorageRedundancy', 'type': 'str'}, + 'keys': {'key': 'keys', 'type': '[str]'}, } def __init__( self, *, - backup_interval_in_minutes: Optional[int] = None, - backup_retention_interval_in_hours: Optional[int] = None, - backup_storage_redundancy: Optional[Union[str, "BackupStorageRedundancy"]] = None, + keys: Optional[List[str]] = None, **kwargs ): """ - :keyword backup_interval_in_minutes: An integer representing the interval in minutes between - two backups. - :paramtype backup_interval_in_minutes: int - :keyword backup_retention_interval_in_hours: An integer representing the time (in hours) that - each backup is retained. - :paramtype backup_retention_interval_in_hours: int - :keyword backup_storage_redundancy: Enum to indicate type of backup residency. Possible values - include: "Geo", "Local", "Zone". - :paramtype backup_storage_redundancy: str or - ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy + :keyword keys: List of keys for each MongoDB collection in the Azure Cosmos DB service. + :paramtype keys: list[str] """ - 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 - self.backup_storage_redundancy = backup_storage_redundancy + super(MongoIndexKeys, self).__init__(**kwargs) + self.keys = keys -class Permission(msrest.serialization.Model): - """The set of data plane operations permitted through this Role Definition. +class MongoIndexOptions(msrest.serialization.Model): + """Cosmos DB MongoDB collection index options. - :ivar data_actions: An array of data actions that are allowed. - :vartype data_actions: list[str] - :ivar not_data_actions: An array of data actions that are denied. - :vartype not_data_actions: list[str] + :ivar expire_after_seconds: Expire after seconds. + :vartype expire_after_seconds: int + :ivar unique: Is unique or not. + :vartype unique: bool """ _attribute_map = { - 'data_actions': {'key': 'dataActions', 'type': '[str]'}, - 'not_data_actions': {'key': 'notDataActions', 'type': '[str]'}, + 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, + 'unique': {'key': 'unique', 'type': 'bool'}, } def __init__( self, *, - data_actions: Optional[List[str]] = None, - not_data_actions: Optional[List[str]] = None, + expire_after_seconds: Optional[int] = None, + unique: Optional[bool] = None, **kwargs ): """ - :keyword data_actions: An array of data actions that are allowed. - :paramtype data_actions: list[str] - :keyword not_data_actions: An array of data actions that are denied. - :paramtype not_data_actions: list[str] + :keyword expire_after_seconds: Expire after seconds. + :paramtype expire_after_seconds: int + :keyword unique: Is unique or not. + :paramtype unique: bool """ - super(Permission, self).__init__(**kwargs) - self.data_actions = data_actions - self.not_data_actions = not_data_actions + super(MongoIndexOptions, self).__init__(**kwargs) + self.expire_after_seconds = expire_after_seconds + self.unique = unique -class PhysicalPartitionId(msrest.serialization.Model): - """PhysicalPartitionId object. +class NotebookWorkspace(ARMProxyResource): + """A notebook workspace resource. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Required. Id of a physical partition. + :ivar id: The unique resource identifier of the database account. :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. + :vartype notebook_server_endpoint: str + :ivar status: Status of the notebook workspace. Possible values are: Creating, Online, + Deleting, Failed, Updating. + :vartype status: str """ _validation = { - 'id': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'notebook_server_endpoint': {'readonly': True}, + 'status': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'notebook_server_endpoint': {'key': 'properties.notebookServerEndpoint', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, } def __init__( self, - *, - id: str, **kwargs ): """ - :keyword id: Required. Id of a physical partition. - :paramtype id: str """ - super(PhysicalPartitionId, self).__init__(**kwargs) - self.id = id + super(NotebookWorkspace, self).__init__(**kwargs) + self.notebook_server_endpoint = None + self.status = None -class PhysicalPartitionStorageInfo(msrest.serialization.Model): - """The storage of a physical partition. +class NotebookWorkspaceConnectionInfoResult(msrest.serialization.Model): + """The connection info for the given notebook workspace. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique identifier of the partition. - :vartype id: str - :ivar storage_in_kb: The storage in KB for the physical partition. - :vartype storage_in_kb: float + :ivar auth_token: Specifies auth token used for connecting to Notebook server (uses token-based + auth). + :vartype auth_token: str + :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. + :vartype notebook_server_endpoint: str """ _validation = { - 'id': {'readonly': True}, - 'storage_in_kb': {'readonly': True}, + 'auth_token': {'readonly': True}, + 'notebook_server_endpoint': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'storage_in_kb': {'key': 'storageInKB', 'type': 'float'}, + 'auth_token': {'key': 'authToken', 'type': 'str'}, + 'notebook_server_endpoint': {'key': 'notebookServerEndpoint', 'type': 'str'}, } def __init__( @@ -9499,28 +6627,34 @@ def __init__( ): """ """ - super(PhysicalPartitionStorageInfo, self).__init__(**kwargs) - self.id = None - self.storage_in_kb = None + super(NotebookWorkspaceConnectionInfoResult, self).__init__(**kwargs) + self.auth_token = None + self.notebook_server_endpoint = None -class PhysicalPartitionStorageInfoCollection(msrest.serialization.Model): - """List of physical partitions and their properties returned by a merge operation. +class NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): + """Parameters to create a notebook workspace resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar physical_partition_storage_info_collection: List of physical partitions and their - properties. - :vartype physical_partition_storage_info_collection: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfo] + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str """ _validation = { - 'physical_partition_storage_info_collection': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'physical_partition_storage_info_collection': {'key': 'physicalPartitionStorageInfoCollection', 'type': '[PhysicalPartitionStorageInfo]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( @@ -9529,200 +6663,189 @@ def __init__( ): """ """ - super(PhysicalPartitionStorageInfoCollection, self).__init__(**kwargs) - self.physical_partition_storage_info_collection = None + super(NotebookWorkspaceCreateUpdateParameters, self).__init__(**kwargs) -class PhysicalPartitionThroughputInfoProperties(msrest.serialization.Model): - """The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoProperties object. +class NotebookWorkspaceListResult(msrest.serialization.Model): + """A list of notebook workspace resources. - :ivar physical_partition_throughput_info: Array of physical partition throughput info objects. - :vartype physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + :ivar value: Array of notebook workspace resources. + :vartype value: list[~azure.mgmt.cosmosdb.models.NotebookWorkspace] """ _attribute_map = { - 'physical_partition_throughput_info': {'key': 'physicalPartitionThroughputInfo', 'type': '[PhysicalPartitionThroughputInfoResource]'}, + 'value': {'key': 'value', 'type': '[NotebookWorkspace]'}, } def __init__( self, *, - physical_partition_throughput_info: Optional[List["PhysicalPartitionThroughputInfoResource"]] = None, + value: Optional[List["_models.NotebookWorkspace"]] = None, **kwargs ): """ - :keyword physical_partition_throughput_info: Array of physical partition throughput info - objects. - :paramtype physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + :keyword value: Array of notebook workspace resources. + :paramtype value: list[~azure.mgmt.cosmosdb.models.NotebookWorkspace] """ - super(PhysicalPartitionThroughputInfoProperties, self).__init__(**kwargs) - self.physical_partition_throughput_info = physical_partition_throughput_info - + super(NotebookWorkspaceListResult, self).__init__(**kwargs) + self.value = value -class PhysicalPartitionThroughputInfoResource(msrest.serialization.Model): - """PhysicalPartitionThroughputInfo object. - All required parameters must be populated in order to send to Azure. +class Operation(msrest.serialization.Model): + """REST API operation. - :ivar id: Required. Id of a physical partition. - :vartype id: str - :ivar throughput: Throughput of a physical partition. - :vartype throughput: float + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.cosmosdb.models.OperationDisplay """ - _validation = { - 'id': {'required': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'throughput': {'key': 'throughput', 'type': 'float'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, } def __init__( self, *, - id: str, - throughput: Optional[float] = None, + name: Optional[str] = None, + display: Optional["_models.OperationDisplay"] = None, **kwargs ): """ - :keyword id: Required. Id of a physical partition. - :paramtype id: str - :keyword throughput: Throughput of a physical partition. - :paramtype throughput: float + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.cosmosdb.models.OperationDisplay """ - super(PhysicalPartitionThroughputInfoResource, self).__init__(**kwargs) - self.id = id - self.throughput = throughput - + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display -class PhysicalPartitionThroughputInfoResult(ARMResourceProperties): - """An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. - Variables are only populated by the server, and will be ignored when sending a request. +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: properties of physical partition throughput info. - :vartype resource: - ~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultPropertiesResource + :ivar provider: Service provider: Microsoft.ResourceProvider. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :ivar description: Description of operation. + :vartype description: str """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'PhysicalPartitionThroughputInfoResultPropertiesResource'}, + 'provider': {'key': 'Provider', 'type': 'str'}, + 'resource': {'key': 'Resource', 'type': 'str'}, + 'operation': {'key': 'Operation', 'type': 'str'}, + 'description': {'key': 'Description', 'type': 'str'}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["PhysicalPartitionThroughputInfoResultPropertiesResource"] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: properties of physical partition throughput info. - :paramtype resource: - ~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultPropertiesResource + :keyword provider: Service provider: Microsoft.ResourceProvider. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed: Profile, endpoint, etc. + :paramtype resource: str + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str + :keyword description: Description of operation. + :paramtype description: str """ - super(PhysicalPartitionThroughputInfoResult, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider self.resource = resource + self.operation = operation + self.description = description -class PhysicalPartitionThroughputInfoResultPropertiesResource(PhysicalPartitionThroughputInfoProperties): - """properties of physical partition throughput info. +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. - :ivar physical_partition_throughput_info: Array of physical partition throughput info objects. - :vartype physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + :ivar value: List of operations supported by the Resource Provider. + :vartype value: list[~azure.mgmt.cosmosdb.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { - 'physical_partition_throughput_info': {'key': 'physicalPartitionThroughputInfo', 'type': '[PhysicalPartitionThroughputInfoResource]'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - physical_partition_throughput_info: Optional[List["PhysicalPartitionThroughputInfoResource"]] = None, + value: Optional[List["_models.Operation"]] = None, + next_link: Optional[str] = None, **kwargs ): """ - :keyword physical_partition_throughput_info: Array of physical partition throughput info - objects. - :paramtype physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + :keyword value: List of operations supported by the Resource Provider. + :paramtype value: list[~azure.mgmt.cosmosdb.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str """ - super(PhysicalPartitionThroughputInfoResultPropertiesResource, self).__init__(physical_partition_throughput_info=physical_partition_throughput_info, **kwargs) + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class PartitionMetric(Metric): + """The metric values for a single partition. Variables are only populated by the server, and will be ignored when sending a request. - :ivar 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: ~datetime.datetime + :ivar time_grain: The time grain to be used to summarize the metric values. + :vartype time_grain: str + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar metric_values: The metric values for the specified time window and timestep. + :vartype metric_values: list[~azure.mgmt.cosmosdb.models.MetricValue] + :ivar partition_id: The partition id (GUID identifier) of the metric values. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer identifier) of the metric + values. + :vartype partition_key_range_id: str """ _validation = { - 'id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'unit': {'readonly': True}, 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'metric_values': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[MetricValue]'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, } def __init__( @@ -9731,37 +6854,26 @@ def __init__( ): """ """ - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + super(PartitionMetric, self).__init__(**kwargs) + self.partition_id = None + self.partition_key_range_id = None -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. +class PartitionMetricListResult(msrest.serialization.Model): + """The response to a list partition metrics request. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str + :ivar value: The list of partition-level metrics for the account. + :vartype value: list[~azure.mgmt.cosmosdb.models.PartitionMetric] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PartitionMetric]'}, } def __init__( @@ -9770,163 +6882,175 @@ def __init__( ): """ """ - super(ProxyResource, self).__init__(**kwargs) + super(PartitionMetricListResult, self).__init__(**kwargs) + self.value = None -class PrivateEndpointConnection(ProxyResource): - """A private endpoint connection. +class Usage(msrest.serialization.Model): + """The usage data for a usage request. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar private_endpoint: Private endpoint which the connection belongs to. - :vartype private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty - :ivar private_link_service_connection_state: Connection State of the Private Endpoint - Connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty - :ivar group_id: Group id of the private endpoint. - :vartype group_id: str - :ivar provisioning_state: Provisioning state of the private endpoint. - :vartype provisioning_state: str + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric. + :vartype limit: long + :ivar current_value: Current value for this metric. + :vartype current_value: long """ _validation = { - 'id': {'readonly': True}, + 'unit': {'readonly': True}, 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, } def __init__( self, - *, - private_endpoint: Optional["PrivateEndpointProperty"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionStateProperty"] = None, - group_id: Optional[str] = None, - provisioning_state: Optional[str] = None, **kwargs ): """ - :keyword private_endpoint: Private endpoint which the connection belongs to. - :paramtype private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty - :keyword private_link_service_connection_state: Connection State of the Private Endpoint - Connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty - :keyword group_id: Group id of the private endpoint. - :paramtype group_id: str - :keyword provisioning_state: Provisioning state of the private endpoint. - :paramtype provisioning_state: str """ - 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 - self.provisioning_state = provisioning_state + super(Usage, self).__init__(**kwargs) + self.unit = None + self.name = None + self.quota_period = None + self.limit = None + self.current_value = None -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """A list of private endpoint connections. +class PartitionUsage(Usage): + """The partition level usage data for a usage request. - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric. + :vartype limit: long + :ivar current_value: Current value for this metric. + :vartype current_value: long + :ivar partition_id: The partition id (GUID identifier) of the usages. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer identifier) of the usages. + :vartype partition_key_range_id: str """ + _validation = { + 'unit': {'readonly': True}, + 'name': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'limit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'partition_id': {'readonly': True}, + 'partition_key_range_id': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'partition_id': {'key': 'partitionId', 'type': 'str'}, + 'partition_key_range_id': {'key': 'partitionKeyRangeId', 'type': 'str'}, } def __init__( self, - *, - value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): """ - :keyword value: Array of private endpoint connections. - :paramtype value: list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = value + super(PartitionUsage, self).__init__(**kwargs) + self.partition_id = None + self.partition_key_range_id = None -class PrivateEndpointProperty(msrest.serialization.Model): - """Private endpoint which the connection belongs to. +class PartitionUsagesResult(msrest.serialization.Model): + """The response to a list partition level usage request. - :ivar id: Resource id of the private endpoint. - :vartype id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of partition-level usages for the database. A usage is a point in time + metric. + :vartype value: list[~azure.mgmt.cosmosdb.models.PartitionUsage] """ + _validation = { + 'value': {'readonly': True}, + } + _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PartitionUsage]'}, } def __init__( self, - *, - id: Optional[str] = None, **kwargs ): """ - :keyword id: Resource id of the private endpoint. - :paramtype id: str - """ - super(PrivateEndpointProperty, self).__init__(**kwargs) - self.id = id - - -class PrivateLinkResource(ARMProxyResource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource required zone names. - :vartype required_zone_names: list[str] + """ + super(PartitionUsagesResult, self).__init__(**kwargs) + self.value = None + + +class PercentileMetric(msrest.serialization.Model): + """Percentile Metric data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: ~datetime.datetime + :ivar time_grain: The time grain to be used to summarize the metric values. + :vartype time_grain: str + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar metric_values: The percentile metric values for the specified time window and timestep. + :vartype metric_values: list[~azure.mgmt.cosmosdb.models.PercentileMetricValue] """ _validation = { - 'id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'time_grain': {'readonly': True}, + 'unit': {'readonly': True}, 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, + 'metric_values': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'MetricName'}, + 'metric_values': {'key': 'metricValues', 'type': '[PercentileMetricValue]'}, } def __init__( @@ -9935,499 +7059,479 @@ def __init__( ): """ """ - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = None + super(PercentileMetric, self).__init__(**kwargs) + self.start_time = None + self.end_time = None + self.time_grain = None + self.unit = None + self.name = None + self.metric_values = None -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. +class PercentileMetricListResult(msrest.serialization.Model): + """The response to a list percentile metrics request. - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.cosmosdb.models.PrivateLinkResource] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of percentile metrics for the account. + :vartype value: list[~azure.mgmt.cosmosdb.models.PercentileMetric] """ + _validation = { + 'value': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'value': {'key': 'value', 'type': '[PercentileMetric]'}, } def __init__( self, - *, - value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.cosmosdb.models.PrivateLinkResource] """ - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = value + super(PercentileMetricListResult, self).__init__(**kwargs) + self.value = None -class PrivateLinkServiceConnectionStateProperty(msrest.serialization.Model): - """Connection State of the Private Endpoint Connection. +class PercentileMetricValue(MetricValue): + """Represents percentile metrics values. Variables are only populated by the server, and will be ignored when sending a request. - :ivar status: The private link service connection status. - :vartype status: str - :ivar description: The private link service connection description. - :vartype description: str - :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ - disconnect). - :vartype actions_required: str + :ivar count: The number of values for the metric. + :vartype count: int + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: ~datetime.datetime + :ivar total: The total value of the metric. + :vartype total: float + :ivar p10: The 10th percentile value for the metric. + :vartype p10: float + :ivar p25: The 25th percentile value for the metric. + :vartype p25: float + :ivar p50: The 50th percentile value for the metric. + :vartype p50: float + :ivar p75: The 75th percentile value for the metric. + :vartype p75: float + :ivar p90: The 90th percentile value for the metric. + :vartype p90: float + :ivar p95: The 95th percentile value for the metric. + :vartype p95: float + :ivar p99: The 99th percentile value for the metric. + :vartype p99: float """ _validation = { - 'actions_required': {'readonly': True}, + 'count': {'readonly': True}, + 'average': {'readonly': True}, + 'maximum': {'readonly': True}, + 'minimum': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'total': {'readonly': True}, + 'p10': {'readonly': True}, + 'p25': {'readonly': True}, + 'p50': {'readonly': True}, + 'p75': {'readonly': True}, + 'p90': {'readonly': True}, + 'p95': {'readonly': True}, + 'p99': {'readonly': True}, } _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + 'count': {'key': '_count', 'type': 'int'}, + 'average': {'key': 'average', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'total': {'key': 'total', 'type': 'float'}, + 'p10': {'key': 'P10', 'type': 'float'}, + 'p25': {'key': 'P25', 'type': 'float'}, + 'p50': {'key': 'P50', 'type': 'float'}, + 'p75': {'key': 'P75', 'type': 'float'}, + 'p90': {'key': 'P90', 'type': 'float'}, + 'p95': {'key': 'P95', 'type': 'float'}, + 'p99': {'key': 'P99', 'type': 'float'}, } def __init__( self, - *, - status: Optional[str] = None, - description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. - :paramtype status: str - :keyword description: The private link service connection description. - :paramtype description: str """ - super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = None + super(PercentileMetricValue, self).__init__(**kwargs) + self.p10 = None + self.p25 = None + self.p50 = None + self.p75 = None + self.p90 = None + self.p95 = None + self.p99 = None -class Privilege(msrest.serialization.Model): - """The set of data plane operations permitted through this Role Definition. +class PeriodicModeBackupPolicy(BackupPolicy): + """The object representing periodic mode backup policy. + + All required parameters must be populated in order to send to Azure. - :ivar resource: An Azure Cosmos DB Mongo DB Resource. - :vartype resource: ~azure.mgmt.cosmosdb.models.PrivilegeResource - :ivar actions: An array of actions that are allowed. - :vartype actions: list[str] + :ivar type: Required. Describes the mode of backups.Constant filled by server. Known values + are: "Periodic", "Continuous". + :vartype type: str or ~azure.mgmt.cosmosdb.models.BackupPolicyType + :ivar migration_state: The object representing the state of the migration between the backup + policies. + :vartype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState + :ivar periodic_mode_properties: Configuration values for periodic mode backup. + :vartype periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { - 'resource': {'key': 'resource', 'type': 'PrivilegeResource'}, - 'actions': {'key': 'actions', 'type': '[str]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'migration_state': {'key': 'migrationState', 'type': 'BackupPolicyMigrationState'}, + 'periodic_mode_properties': {'key': 'periodicModeProperties', 'type': 'PeriodicModeProperties'}, } def __init__( self, *, - resource: Optional["PrivilegeResource"] = None, - actions: Optional[List[str]] = None, + migration_state: Optional["_models.BackupPolicyMigrationState"] = None, + periodic_mode_properties: Optional["_models.PeriodicModeProperties"] = None, **kwargs ): """ - :keyword resource: An Azure Cosmos DB Mongo DB Resource. - :paramtype resource: ~azure.mgmt.cosmosdb.models.PrivilegeResource - :keyword actions: An array of actions that are allowed. - :paramtype actions: list[str] + :keyword migration_state: The object representing the state of the migration between the backup + policies. + :paramtype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState + :keyword periodic_mode_properties: Configuration values for periodic mode backup. + :paramtype periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties """ - super(Privilege, self).__init__(**kwargs) - self.resource = resource - self.actions = actions + super(PeriodicModeBackupPolicy, self).__init__(migration_state=migration_state, **kwargs) + self.type = 'Periodic' # type: str + self.periodic_mode_properties = periodic_mode_properties -class PrivilegeResource(msrest.serialization.Model): - """An Azure Cosmos DB Mongo DB Resource. +class PeriodicModeProperties(msrest.serialization.Model): + """Configuration values for periodic mode backup. - :ivar db: The database name the role is applied. - :vartype db: str - :ivar collection: The collection name the role is applied. - :vartype collection: str + :ivar backup_interval_in_minutes: An integer representing the interval in minutes between two + backups. + :vartype backup_interval_in_minutes: int + :ivar backup_retention_interval_in_hours: An integer representing the time (in hours) that each + backup is retained. + :vartype backup_retention_interval_in_hours: int + :ivar backup_storage_redundancy: Enum to indicate type of backup residency. Known values are: + "Geo", "Local", "Zone". + :vartype backup_storage_redundancy: str or ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy """ + _validation = { + 'backup_interval_in_minutes': {'minimum': 0}, + 'backup_retention_interval_in_hours': {'minimum': 0}, + } + _attribute_map = { - 'db': {'key': 'db', 'type': 'str'}, - 'collection': {'key': 'collection', 'type': 'str'}, + 'backup_interval_in_minutes': {'key': 'backupIntervalInMinutes', 'type': 'int'}, + 'backup_retention_interval_in_hours': {'key': 'backupRetentionIntervalInHours', 'type': 'int'}, + 'backup_storage_redundancy': {'key': 'backupStorageRedundancy', 'type': 'str'}, } def __init__( self, *, - db: Optional[str] = None, - collection: Optional[str] = None, + backup_interval_in_minutes: Optional[int] = None, + backup_retention_interval_in_hours: Optional[int] = None, + backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None, **kwargs ): """ - :keyword db: The database name the role is applied. - :paramtype db: str - :keyword collection: The collection name the role is applied. - :paramtype collection: str + :keyword backup_interval_in_minutes: An integer representing the interval in minutes between + two backups. + :paramtype backup_interval_in_minutes: int + :keyword backup_retention_interval_in_hours: An integer representing the time (in hours) that + each backup is retained. + :paramtype backup_retention_interval_in_hours: int + :keyword backup_storage_redundancy: Enum to indicate type of backup residency. Known values + are: "Geo", "Local", "Zone". + :paramtype backup_storage_redundancy: str or + ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy """ - super(PrivilegeResource, self).__init__(**kwargs) - self.db = db - self.collection = collection - - -class RedistributeThroughputParameters(ARMResourceProperties): - """Cosmos DB redistribute throughput parameters object. + 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 + self.backup_storage_redundancy = backup_storage_redundancy - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class Permission(msrest.serialization.Model): + """The set of data plane operations permitted through this Role Definition. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: Required. The standard JSON format of a resource throughput. - :vartype resource: ~azure.mgmt.cosmosdb.models.RedistributeThroughputPropertiesResource + :ivar data_actions: An array of data actions that are allowed. + :vartype data_actions: list[str] + :ivar not_data_actions: An array of data actions that are denied. + :vartype not_data_actions: list[str] """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource': {'required': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'RedistributeThroughputPropertiesResource'}, + 'data_actions': {'key': 'dataActions', 'type': '[str]'}, + 'not_data_actions': {'key': 'notDataActions', 'type': '[str]'}, } def __init__( self, *, - resource: "RedistributeThroughputPropertiesResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, + data_actions: Optional[List[str]] = None, + not_data_actions: Optional[List[str]] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: Required. The standard JSON format of a resource throughput. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RedistributeThroughputPropertiesResource + :keyword data_actions: An array of data actions that are allowed. + :paramtype data_actions: list[str] + :keyword not_data_actions: An array of data actions that are denied. + :paramtype not_data_actions: list[str] """ - super(RedistributeThroughputParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource + super(Permission, self).__init__(**kwargs) + self.data_actions = data_actions + self.not_data_actions = not_data_actions -class RedistributeThroughputPropertiesResource(msrest.serialization.Model): - """Resource to redistribute throughput for Azure Cosmos DB resource. +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar throughput_policy: Required. ThroughputPolicy to apply for throughput redistribution. - Possible values include: "none", "equal", "custom". - :vartype throughput_policy: str or ~azure.mgmt.cosmosdb.models.ThroughputPolicyType - :ivar target_physical_partition_throughput_info: Required. Array of - PhysicalPartitionThroughputInfoResource objects. - :vartype target_physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] - :ivar source_physical_partition_throughput_info: Required. Array of - PhysicalPartitionThroughputInfoResource objects. - :vartype source_physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + :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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str """ _validation = { - 'throughput_policy': {'required': True}, - 'target_physical_partition_throughput_info': {'required': True}, - 'source_physical_partition_throughput_info': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'throughput_policy': {'key': 'throughputPolicy', 'type': 'str'}, - 'target_physical_partition_throughput_info': {'key': 'targetPhysicalPartitionThroughputInfo', 'type': '[PhysicalPartitionThroughputInfoResource]'}, - 'source_physical_partition_throughput_info': {'key': 'sourcePhysicalPartitionThroughputInfo', 'type': '[PhysicalPartitionThroughputInfoResource]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, - *, - throughput_policy: Union[str, "ThroughputPolicyType"], - target_physical_partition_throughput_info: List["PhysicalPartitionThroughputInfoResource"], - source_physical_partition_throughput_info: List["PhysicalPartitionThroughputInfoResource"], **kwargs ): """ - :keyword throughput_policy: Required. ThroughputPolicy to apply for throughput redistribution. - Possible values include: "none", "equal", "custom". - :paramtype throughput_policy: str or ~azure.mgmt.cosmosdb.models.ThroughputPolicyType - :keyword target_physical_partition_throughput_info: Required. Array of - PhysicalPartitionThroughputInfoResource objects. - :paramtype target_physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] - :keyword source_physical_partition_throughput_info: Required. Array of - PhysicalPartitionThroughputInfoResource objects. - :paramtype source_physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] """ - super(RedistributeThroughputPropertiesResource, self).__init__(**kwargs) - self.throughput_policy = throughput_policy - self.target_physical_partition_throughput_info = target_physical_partition_throughput_info - self.source_physical_partition_throughput_info = source_physical_partition_throughput_info + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class RegionForOnlineOffline(msrest.serialization.Model): - """Cosmos DB region to online or offline. +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar region: Required. Cosmos DB region, with spaces between words and each word capitalized. - :vartype region: str + :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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str """ _validation = { - 'region': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, - *, - region: str, **kwargs ): """ - :keyword region: Required. Cosmos DB region, with spaces between words and each word - capitalized. - :paramtype region: str """ - super(RegionForOnlineOffline, self).__init__(**kwargs) - self.region = region + super(ProxyResource, self).__init__(**kwargs) -class RestorableDatabaseAccountGetResult(msrest.serialization.Model): - """A Azure Cosmos DB restorable database account. +class PrivateEndpointConnection(ProxyResource): + """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the ARM resource. + :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 ARM resource. + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of Azure resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar account_name: The name of the global database account. - :vartype account_name: str - :ivar creation_time: The creation time of the restorable database account (ISO-8601 format). - :vartype creation_time: ~datetime.datetime - :ivar oldest_restorable_time: The least recent time at which the database account can be - restored to (ISO-8601 format). - :vartype oldest_restorable_time: ~datetime.datetime - :ivar deletion_time: The time at which the restorable database account has been deleted - (ISO-8601 format). - :vartype deletion_time: ~datetime.datetime - :ivar api_type: The API type of the restorable database account. Possible values include: - "MongoDB", "Gremlin", "Cassandra", "Table", "Sql", "GremlinV2". - :vartype api_type: str or ~azure.mgmt.cosmosdb.models.ApiType - :ivar restorable_locations: List of regions where the of the database account can be restored - from. - :vartype restorable_locations: list[~azure.mgmt.cosmosdb.models.RestorableLocationResource] + :ivar private_endpoint: Private endpoint which the connection belongs to. + :vartype private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty + :ivar private_link_service_connection_state: Connection State of the Private Endpoint + Connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty + :ivar group_id: Group id of the private endpoint. + :vartype group_id: str + :ivar provisioning_state: Provisioning state of the private endpoint. + :vartype provisioning_state: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'api_type': {'readonly': True}, - 'restorable_locations': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'account_name': {'key': 'properties.accountName', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'oldest_restorable_time': {'key': 'properties.oldestRestorableTime', 'type': 'iso-8601'}, - 'deletion_time': {'key': 'properties.deletionTime', 'type': 'iso-8601'}, - 'api_type': {'key': 'properties.apiType', 'type': 'str'}, - 'restorable_locations': {'key': 'properties.restorableLocations', 'type': '[RestorableLocationResource]'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, *, - location: Optional[str] = None, - account_name: Optional[str] = None, - creation_time: Optional[datetime.datetime] = None, - oldest_restorable_time: Optional[datetime.datetime] = None, - deletion_time: Optional[datetime.datetime] = None, + private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, + group_id: Optional[str] = None, + provisioning_state: Optional[str] = None, **kwargs ): """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword account_name: The name of the global database account. - :paramtype account_name: str - :keyword creation_time: The creation time of the restorable database account (ISO-8601 format). - :paramtype creation_time: ~datetime.datetime - :keyword oldest_restorable_time: The least recent time at which the database account can be - restored to (ISO-8601 format). - :paramtype oldest_restorable_time: ~datetime.datetime - :keyword deletion_time: The time at which the restorable database account has been deleted - (ISO-8601 format). - :paramtype deletion_time: ~datetime.datetime + :keyword private_endpoint: Private endpoint which the connection belongs to. + :paramtype private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty + :keyword private_link_service_connection_state: Connection State of the Private Endpoint + Connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty + :keyword group_id: Group id of the private endpoint. + :paramtype group_id: str + :keyword provisioning_state: Provisioning state of the private endpoint. + :paramtype provisioning_state: str """ - super(RestorableDatabaseAccountGetResult, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.account_name = account_name - self.creation_time = creation_time - self.oldest_restorable_time = oldest_restorable_time - self.deletion_time = deletion_time - self.api_type = None - self.restorable_locations = None - + 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 + self.provisioning_state = provisioning_state -class RestorableDatabaseAccountsListResult(msrest.serialization.Model): - """The List operation response, that contains the restorable database accounts and their properties. - Variables are only populated by the server, and will be ignored when sending a request. +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """A list of private endpoint connections. - :ivar value: List of restorable database accounts and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] """ - _validation = { - 'value': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorableDatabaseAccountGetResult]'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, } def __init__( self, + *, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] """ - super(RestorableDatabaseAccountsListResult, self).__init__(**kwargs) - self.value = None - + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value -class RestorableGremlinDatabaseGetResult(msrest.serialization.Model): - """An Azure Cosmos DB Gremlin database event. - Variables are only populated by the server, and will be ignored when sending a request. +class PrivateEndpointProperty(msrest.serialization.Model): + """Private endpoint which the connection belongs to. - :ivar id: The unique resource Identifier of the ARM resource. + :ivar id: Resource id of the private endpoint. :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar resource: The resource of an Azure Cosmos DB Gremlin database event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasePropertiesResource """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'resource': {'key': 'properties.resource', 'type': 'RestorableGremlinDatabasePropertiesResource'}, } def __init__( self, *, - resource: Optional["RestorableGremlinDatabasePropertiesResource"] = None, + id: Optional[str] = None, **kwargs ): """ - :keyword resource: The resource of an Azure Cosmos DB Gremlin database event. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasePropertiesResource + :keyword id: Resource id of the private endpoint. + :paramtype id: str """ - super(RestorableGremlinDatabaseGetResult, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.resource = resource + super(PrivateEndpointProperty, self).__init__(**kwargs) + self.id = id -class RestorableGremlinDatabasePropertiesResource(msrest.serialization.Model): - """The resource of an Azure Cosmos DB Gremlin database event. +class PrivateLinkResource(ARMProxyResource): + """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar operation_type: The operation type of this database event. Possible values include: - "Create", "Replace", "Delete", "SystemOperation". - :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType - :ivar event_timestamp: The time when this database event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of this Gremlin database. - :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this Gremlin database. - :vartype owner_resource_id: str + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource required zone names. + :vartype required_zone_names: list[str] """ _validation = { - 'rid': {'readonly': True}, - 'operation_type': {'readonly': True}, - 'event_timestamp': {'readonly': True}, - 'owner_id': {'readonly': True}, - 'owner_resource_id': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + 'required_zone_names': {'readonly': True}, } _attribute_map = { - 'rid': {'key': '_rid', 'type': 'str'}, - 'operation_type': {'key': 'operationType', 'type': 'str'}, - 'event_timestamp': {'key': 'eventTimestamp', 'type': 'str'}, - 'owner_id': {'key': 'ownerId', 'type': 'str'}, - 'owner_resource_id': {'key': 'ownerResourceId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, } def __init__( @@ -10436,169 +7540,199 @@ def __init__( ): """ """ - super(RestorableGremlinDatabasePropertiesResource, self).__init__(**kwargs) - self.rid = None - self.operation_type = None - self.event_timestamp = None - self.owner_id = None - self.owner_resource_id = None - + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = None -class RestorableGremlinDatabasesListResult(msrest.serialization.Model): - """The List operation response, that contains the Gremlin database events and their properties. - Variables are only populated by the server, and will be ignored when sending a request. +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. - :ivar value: List of Gremlin database events and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableGremlinDatabaseGetResult] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.cosmosdb.models.PrivateLinkResource] """ - _validation = { - 'value': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorableGremlinDatabaseGetResult]'}, + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } def __init__( self, + *, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.cosmosdb.models.PrivateLinkResource] """ - super(RestorableGremlinDatabasesListResult, self).__init__(**kwargs) - self.value = None + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value -class RestorableGremlinGraphGetResult(msrest.serialization.Model): - """An Azure Cosmos DB Gremlin graph event. +class PrivateLinkServiceConnectionStateProperty(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. - :ivar id: The unique resource Identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar resource: The resource of an Azure Cosmos DB Gremlin graph event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphPropertiesResource + :ivar status: The private link service connection status. + :vartype status: str + :ivar description: The private link service connection description. + :vartype description: str + :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ + disconnect). + :vartype actions_required: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'actions_required': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'resource': {'key': 'properties.resource', 'type': 'RestorableGremlinGraphPropertiesResource'}, + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( self, *, - resource: Optional["RestorableGremlinGraphPropertiesResource"] = None, + status: Optional[str] = None, + description: Optional[str] = None, **kwargs ): """ - :keyword resource: The resource of an Azure Cosmos DB Gremlin graph event. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphPropertiesResource + :keyword status: The private link service connection status. + :paramtype status: str + :keyword description: The private link service connection description. + :paramtype description: str """ - super(RestorableGremlinGraphGetResult, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.resource = resource + super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = None -class RestorableGremlinGraphPropertiesResource(msrest.serialization.Model): - """The resource of an Azure Cosmos DB Gremlin graph event. +class RegionForOnlineOffline(msrest.serialization.Model): + """Cosmos DB region to online or offline. - 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 rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar operation_type: The operation type of this graph event. Possible values include: - "Create", "Replace", "Delete", "SystemOperation". - :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType - :ivar event_timestamp: The time when this graph event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of this Gremlin graph. - :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this Gremlin graph. - :vartype owner_resource_id: str + :ivar region: Required. Cosmos DB region, with spaces between words and each word capitalized. + :vartype region: str """ _validation = { - 'rid': {'readonly': True}, - 'operation_type': {'readonly': True}, - 'event_timestamp': {'readonly': True}, - 'owner_id': {'readonly': True}, - 'owner_resource_id': {'readonly': True}, + 'region': {'required': True}, } _attribute_map = { - 'rid': {'key': '_rid', 'type': 'str'}, - 'operation_type': {'key': 'operationType', 'type': 'str'}, - 'event_timestamp': {'key': 'eventTimestamp', 'type': 'str'}, - 'owner_id': {'key': 'ownerId', 'type': 'str'}, - 'owner_resource_id': {'key': 'ownerResourceId', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, } def __init__( self, + *, + region: str, **kwargs ): """ + :keyword region: Required. Cosmos DB region, with spaces between words and each word + capitalized. + :paramtype region: str """ - super(RestorableGremlinGraphPropertiesResource, self).__init__(**kwargs) - self.rid = None - self.operation_type = None - self.event_timestamp = None - self.owner_id = None - self.owner_resource_id = None + super(RegionForOnlineOffline, self).__init__(**kwargs) + self.region = region -class RestorableGremlinGraphsListResult(msrest.serialization.Model): - """The List operation response, that contains the Gremlin graph events and their properties. +class RestorableDatabaseAccountGetResult(msrest.serialization.Model): + """A Azure Cosmos DB restorable database account. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Gremlin graph events and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableGremlinGraphGetResult] + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar account_name: The name of the global database account. + :vartype account_name: str + :ivar creation_time: The creation time of the restorable database account (ISO-8601 format). + :vartype creation_time: ~datetime.datetime + :ivar deletion_time: The time at which the restorable database account has been deleted + (ISO-8601 format). + :vartype deletion_time: ~datetime.datetime + :ivar api_type: The API type of the restorable database account. Known values are: "MongoDB", + "Gremlin", "Cassandra", "Table", "Sql", "GremlinV2". + :vartype api_type: str or ~azure.mgmt.cosmosdb.models.ApiType + :ivar restorable_locations: List of regions where the of the database account can be restored + from. + :vartype restorable_locations: list[~azure.mgmt.cosmosdb.models.RestorableLocationResource] """ _validation = { - 'value': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'api_type': {'readonly': True}, + 'restorable_locations': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorableGremlinGraphGetResult]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'account_name': {'key': 'properties.accountName', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'deletion_time': {'key': 'properties.deletionTime', 'type': 'iso-8601'}, + 'api_type': {'key': 'properties.apiType', 'type': 'str'}, + 'restorable_locations': {'key': 'properties.restorableLocations', 'type': '[RestorableLocationResource]'}, } def __init__( self, + *, + location: Optional[str] = None, + account_name: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + deletion_time: Optional[datetime.datetime] = None, **kwargs ): """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword account_name: The name of the global database account. + :paramtype account_name: str + :keyword creation_time: The creation time of the restorable database account (ISO-8601 format). + :paramtype creation_time: ~datetime.datetime + :keyword deletion_time: The time at which the restorable database account has been deleted + (ISO-8601 format). + :paramtype deletion_time: ~datetime.datetime """ - super(RestorableGremlinGraphsListResult, self).__init__(**kwargs) - self.value = None + super(RestorableDatabaseAccountGetResult, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.account_name = account_name + self.creation_time = creation_time + self.deletion_time = deletion_time + self.api_type = None + self.restorable_locations = None -class RestorableGremlinResourcesListResult(msrest.serialization.Model): - """The List operation response, that contains the restorable Gremlin resources. +class RestorableDatabaseAccountsListResult(msrest.serialization.Model): + """The List operation response, that contains the restorable database accounts and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of restorable Gremlin resources, including the gremlin database and graph - names. - :vartype value: list[~azure.mgmt.cosmosdb.models.GremlinDatabaseRestoreResource] + :ivar value: List of restorable database accounts and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] """ _validation = { @@ -10606,7 +7740,7 @@ class RestorableGremlinResourcesListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[GremlinDatabaseRestoreResource]'}, + 'value': {'key': 'value', 'type': '[RestorableDatabaseAccountGetResult]'}, } def __init__( @@ -10615,7 +7749,7 @@ def __init__( ): """ """ - super(RestorableGremlinResourcesListResult, self).__init__(**kwargs) + super(RestorableDatabaseAccountsListResult, self).__init__(**kwargs) self.value = None @@ -10695,7 +7829,7 @@ class RestorableMongodbCollectionGetResult(msrest.serialization.Model): def __init__( self, *, - resource: Optional["RestorableMongodbCollectionPropertiesResource"] = None, + resource: Optional["_models.RestorableMongodbCollectionPropertiesResource"] = None, **kwargs ): """ @@ -10716,8 +7850,8 @@ class RestorableMongodbCollectionPropertiesResource(msrest.serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str - :ivar operation_type: The operation type of this collection event. Possible values include: - "Create", "Replace", "Delete", "SystemOperation". + :ivar operation_type: The operation type of this collection event. Known values are: "Create", + "Replace", "Delete", "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The time when this collection event happened. :vartype event_timestamp: str @@ -10815,7 +7949,7 @@ class RestorableMongodbDatabaseGetResult(msrest.serialization.Model): def __init__( self, *, - resource: Optional["RestorableMongodbDatabasePropertiesResource"] = None, + resource: Optional["_models.RestorableMongodbDatabasePropertiesResource"] = None, **kwargs ): """ @@ -10836,8 +7970,8 @@ class RestorableMongodbDatabasePropertiesResource(msrest.serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str - :ivar operation_type: The operation type of this database event. Possible values include: - "Create", "Replace", "Delete", "SystemOperation". + :ivar operation_type: The operation type of this database event. Known values are: "Create", + "Replace", "Delete", "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The time when this database event happened. :vartype event_timestamp: str @@ -10904,13 +8038,65 @@ def __init__( self.value = None +class RestorableMongodbResourcesGetResult(msrest.serialization.Model): + """Specific Databases to restore. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar database_name: The name of the database available for restore. + :vartype database_name: str + :ivar collection_names: The names of the collections available for restore. + :vartype collection_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + 'collection_names': {'key': 'collectionNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + database_name: Optional[str] = None, + collection_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword database_name: The name of the database available for restore. + :paramtype database_name: str + :keyword collection_names: The names of the collections available for restore. + :paramtype collection_names: list[str] + """ + super(RestorableMongodbResourcesGetResult, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.database_name = database_name + self.collection_names = collection_names + + class RestorableMongodbResourcesListResult(msrest.serialization.Model): """The List operation response, that contains the restorable MongoDB resources. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of restorable MongoDB resources, including the database and collection names. - :vartype value: list[~azure.mgmt.cosmosdb.models.DatabaseRestoreResource] + :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableMongodbResourcesGetResult] """ _validation = { @@ -10918,7 +8104,7 @@ class RestorableMongodbResourcesListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[DatabaseRestoreResource]'}, + 'value': {'key': 'value', 'type': '[RestorableMongodbResourcesGetResult]'}, } def __init__( @@ -10962,7 +8148,7 @@ class RestorableSqlContainerGetResult(msrest.serialization.Model): def __init__( self, *, - resource: Optional["RestorableSqlContainerPropertiesResource"] = None, + resource: Optional["_models.RestorableSqlContainerPropertiesResource"] = None, **kwargs ): """ @@ -10983,8 +8169,8 @@ class RestorableSqlContainerPropertiesResource(msrest.serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str - :ivar operation_type: The operation type of this container event. Possible values include: - "Create", "Replace", "Delete", "SystemOperation". + :ivar operation_type: The operation type of this container event. Known values are: "Create", + "Replace", "Delete", "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The when this container event happened. :vartype event_timestamp: str @@ -11017,7 +8203,7 @@ class RestorableSqlContainerPropertiesResource(msrest.serialization.Model): def __init__( self, *, - container: Optional["RestorableSqlContainerPropertiesResourceContainer"] = None, + container: Optional["_models.RestorableSqlContainerPropertiesResourceContainer"] = None, **kwargs ): """ @@ -11054,8 +8240,6 @@ class SqlContainerResource(msrest.serialization.Model): :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy :ivar conflict_resolution_policy: The conflict resolution policy for the container. :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - :ivar client_encryption_policy: The client encryption policy for the container. - :vartype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :ivar analytical_storage_ttl: Analytical TTL. :vartype analytical_storage_ttl: long """ @@ -11071,7 +8255,6 @@ class SqlContainerResource(msrest.serialization.Model): 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, - 'client_encryption_policy': {'key': 'clientEncryptionPolicy', 'type': 'ClientEncryptionPolicy'}, 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'long'}, } @@ -11079,12 +8262,11 @@ def __init__( self, *, id: str, - indexing_policy: Optional["IndexingPolicy"] = None, - partition_key: Optional["ContainerPartitionKey"] = None, + indexing_policy: Optional["_models.IndexingPolicy"] = None, + partition_key: Optional["_models.ContainerPartitionKey"] = None, default_ttl: Optional[int] = None, - unique_key_policy: Optional["UniqueKeyPolicy"] = None, - conflict_resolution_policy: Optional["ConflictResolutionPolicy"] = None, - client_encryption_policy: Optional["ClientEncryptionPolicy"] = None, + unique_key_policy: Optional["_models.UniqueKeyPolicy"] = None, + conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, analytical_storage_ttl: Optional[int] = None, **kwargs ): @@ -11104,8 +8286,6 @@ def __init__( :paramtype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy :keyword conflict_resolution_policy: The conflict resolution policy for the container. :paramtype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - :keyword client_encryption_policy: The client encryption policy for the container. - :paramtype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :keyword analytical_storage_ttl: Analytical TTL. :paramtype analytical_storage_ttl: long """ @@ -11116,7 +8296,6 @@ def __init__( self.default_ttl = default_ttl self.unique_key_policy = unique_key_policy self.conflict_resolution_policy = conflict_resolution_policy - self.client_encryption_policy = client_encryption_policy self.analytical_storage_ttl = analytical_storage_ttl @@ -11142,8 +8321,6 @@ class RestorableSqlContainerPropertiesResourceContainer(ExtendedResourceProperti :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy :ivar conflict_resolution_policy: The conflict resolution policy for the container. :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - :ivar client_encryption_policy: The client encryption policy for the container. - :vartype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :ivar analytical_storage_ttl: Analytical TTL. :vartype analytical_storage_ttl: long :ivar rid: A system generated property. A unique identifier. @@ -11173,7 +8350,6 @@ class RestorableSqlContainerPropertiesResourceContainer(ExtendedResourceProperti 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, - 'client_encryption_policy': {'key': 'clientEncryptionPolicy', 'type': 'ClientEncryptionPolicy'}, 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'long'}, 'rid': {'key': '_rid', 'type': 'str'}, 'ts': {'key': '_ts', 'type': 'float'}, @@ -11185,12 +8361,11 @@ def __init__( self, *, id: str, - indexing_policy: Optional["IndexingPolicy"] = None, - partition_key: Optional["ContainerPartitionKey"] = None, + indexing_policy: Optional["_models.IndexingPolicy"] = None, + partition_key: Optional["_models.ContainerPartitionKey"] = None, default_ttl: Optional[int] = None, - unique_key_policy: Optional["UniqueKeyPolicy"] = None, - conflict_resolution_policy: Optional["ConflictResolutionPolicy"] = None, - client_encryption_policy: Optional["ClientEncryptionPolicy"] = None, + unique_key_policy: Optional["_models.UniqueKeyPolicy"] = None, + conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, analytical_storage_ttl: Optional[int] = None, **kwargs ): @@ -11210,19 +8385,16 @@ def __init__( :paramtype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy :keyword conflict_resolution_policy: The conflict resolution policy for the container. :paramtype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - :keyword client_encryption_policy: The client encryption policy for the container. - :paramtype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :keyword analytical_storage_ttl: Analytical TTL. :paramtype analytical_storage_ttl: long """ - super(RestorableSqlContainerPropertiesResourceContainer, self).__init__(id=id, indexing_policy=indexing_policy, partition_key=partition_key, default_ttl=default_ttl, unique_key_policy=unique_key_policy, conflict_resolution_policy=conflict_resolution_policy, client_encryption_policy=client_encryption_policy, analytical_storage_ttl=analytical_storage_ttl, **kwargs) + super(RestorableSqlContainerPropertiesResourceContainer, self).__init__(id=id, indexing_policy=indexing_policy, partition_key=partition_key, default_ttl=default_ttl, unique_key_policy=unique_key_policy, conflict_resolution_policy=conflict_resolution_policy, analytical_storage_ttl=analytical_storage_ttl, **kwargs) self.id = id self.indexing_policy = indexing_policy self.partition_key = partition_key self.default_ttl = default_ttl self.unique_key_policy = unique_key_policy self.conflict_resolution_policy = conflict_resolution_policy - self.client_encryption_policy = client_encryption_policy self.analytical_storage_ttl = analytical_storage_ttl self.self_property = None self.rid = None @@ -11288,7 +8460,7 @@ class RestorableSqlDatabaseGetResult(msrest.serialization.Model): def __init__( self, *, - resource: Optional["RestorableSqlDatabasePropertiesResource"] = None, + resource: Optional["_models.RestorableSqlDatabasePropertiesResource"] = None, **kwargs ): """ @@ -11309,8 +8481,8 @@ class RestorableSqlDatabasePropertiesResource(msrest.serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str - :ivar operation_type: The operation type of this database event. Possible values include: - "Create", "Replace", "Delete", "SystemOperation". + :ivar operation_type: The operation type of this database event. Known values are: "Create", + "Replace", "Delete", "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The time when this database event happened. :vartype event_timestamp: str @@ -11342,7 +8514,7 @@ class RestorableSqlDatabasePropertiesResource(msrest.serialization.Model): def __init__( self, *, - database: Optional["RestorableSqlDatabasePropertiesResourceDatabase"] = None, + database: Optional["_models.RestorableSqlDatabasePropertiesResourceDatabase"] = None, **kwargs ): """ @@ -11471,34 +8643,7 @@ class RestorableSqlDatabasesListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorableSqlDatabaseGetResult]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RestorableSqlDatabasesListResult, self).__init__(**kwargs) - self.value = None - - -class RestorableSqlResourcesListResult(msrest.serialization.Model): - """The List operation response, that contains the restorable SQL resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of restorable SQL resources, including the database and collection names. - :vartype value: list[~azure.mgmt.cosmosdb.models.DatabaseRestoreResource] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DatabaseRestoreResource]'}, + 'value': {'key': 'value', 'type': '[RestorableSqlDatabaseGetResult]'}, } def __init__( @@ -11507,23 +8652,25 @@ def __init__( ): """ """ - super(RestorableSqlResourcesListResult, self).__init__(**kwargs) + super(RestorableSqlDatabasesListResult, self).__init__(**kwargs) self.value = None -class RestorableTableGetResult(msrest.serialization.Model): - """An Azure Cosmos DB Table event. +class RestorableSqlResourcesGetResult(msrest.serialization.Model): + """Specific Databases to restore. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource Identifier of the ARM resource. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :ivar resource: The resource of an Azure Cosmos DB Table event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableTablePropertiesResource + :ivar database_name: The name of the database available for restore. + :vartype database_name: str + :ivar collection_names: The names of the collections available for restore. + :vartype collection_names: list[str] """ _validation = { @@ -11536,108 +8683,38 @@ class RestorableTableGetResult(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'resource': {'key': 'properties.resource', 'type': 'RestorableTablePropertiesResource'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + 'collection_names': {'key': 'collectionNames', 'type': '[str]'}, } def __init__( self, *, - resource: Optional["RestorableTablePropertiesResource"] = None, + database_name: Optional[str] = None, + collection_names: Optional[List[str]] = None, **kwargs ): """ - :keyword resource: The resource of an Azure Cosmos DB Table event. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableTablePropertiesResource + :keyword database_name: The name of the database available for restore. + :paramtype database_name: str + :keyword collection_names: The names of the collections available for restore. + :paramtype collection_names: list[str] """ - super(RestorableTableGetResult, self).__init__(**kwargs) + super(RestorableSqlResourcesGetResult, self).__init__(**kwargs) self.id = None self.name = None self.type = None - self.resource = resource - - -class RestorableTablePropertiesResource(msrest.serialization.Model): - """The resource of an Azure Cosmos DB Table event. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar operation_type: The operation type of this table event. Possible values include: - "Create", "Replace", "Delete", "SystemOperation". - :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType - :ivar event_timestamp: The time when this table event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of this Table. - :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this Table. - :vartype owner_resource_id: str - """ - - _validation = { - 'rid': {'readonly': True}, - 'operation_type': {'readonly': True}, - 'event_timestamp': {'readonly': True}, - 'owner_id': {'readonly': True}, - 'owner_resource_id': {'readonly': True}, - } - - _attribute_map = { - 'rid': {'key': '_rid', 'type': 'str'}, - 'operation_type': {'key': 'operationType', 'type': 'str'}, - 'event_timestamp': {'key': 'eventTimestamp', 'type': 'str'}, - 'owner_id': {'key': 'ownerId', 'type': 'str'}, - 'owner_resource_id': {'key': 'ownerResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RestorableTablePropertiesResource, self).__init__(**kwargs) - self.rid = None - self.operation_type = None - self.event_timestamp = None - self.owner_id = None - self.owner_resource_id = None - - -class RestorableTableResourcesListResult(msrest.serialization.Model): - """List of restorable table names. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of restorable table names. - :vartype value: list[str] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RestorableTableResourcesListResult, self).__init__(**kwargs) - self.value = None + self.database_name = database_name + self.collection_names = collection_names -class RestorableTablesListResult(msrest.serialization.Model): - """The List operation response, that contains the Table events and their properties. +class RestorableSqlResourcesListResult(msrest.serialization.Model): + """The List operation response, that contains the restorable SQL resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Table events and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableTableGetResult] + :ivar value: List of restorable SQL resources, including the database and collection names. + :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableSqlResourcesGetResult] """ _validation = { @@ -11645,7 +8722,7 @@ class RestorableTablesListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorableTableGetResult]'}, + 'value': {'key': 'value', 'type': '[RestorableSqlResourcesGetResult]'}, } def __init__( @@ -11654,14 +8731,14 @@ def __init__( ): """ """ - super(RestorableTablesListResult, self).__init__(**kwargs) + super(RestorableSqlResourcesListResult, self).__init__(**kwargs) self.value = None class RestoreParameters(msrest.serialization.Model): """Parameters to indicate the information about the restore. - :ivar restore_mode: Describes the mode of the restore. Possible values include: "PointInTime". + :ivar restore_mode: Describes the mode of the restore. Known values are: "PointInTime". :vartype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode :ivar restore_source: The id of the restorable database account from which the restore has to be initiated. For example: @@ -11671,11 +8748,6 @@ class RestoreParameters(msrest.serialization.Model): :vartype restore_timestamp_in_utc: ~datetime.datetime :ivar databases_to_restore: List of specific databases available for restore. :vartype databases_to_restore: list[~azure.mgmt.cosmosdb.models.DatabaseRestoreResource] - :ivar gremlin_databases_to_restore: List of specific gremlin databases available for restore. - :vartype gremlin_databases_to_restore: - list[~azure.mgmt.cosmosdb.models.GremlinDatabaseRestoreResource] - :ivar tables_to_restore: List of specific tables available for restore. - :vartype tables_to_restore: list[str] """ _attribute_map = { @@ -11683,24 +8755,19 @@ class RestoreParameters(msrest.serialization.Model): 'restore_source': {'key': 'restoreSource', 'type': 'str'}, 'restore_timestamp_in_utc': {'key': 'restoreTimestampInUtc', 'type': 'iso-8601'}, 'databases_to_restore': {'key': 'databasesToRestore', 'type': '[DatabaseRestoreResource]'}, - 'gremlin_databases_to_restore': {'key': 'gremlinDatabasesToRestore', 'type': '[GremlinDatabaseRestoreResource]'}, - 'tables_to_restore': {'key': 'tablesToRestore', 'type': '[str]'}, } def __init__( self, *, - restore_mode: Optional[Union[str, "RestoreMode"]] = None, + restore_mode: Optional[Union[str, "_models.RestoreMode"]] = None, restore_source: Optional[str] = None, restore_timestamp_in_utc: Optional[datetime.datetime] = None, - databases_to_restore: Optional[List["DatabaseRestoreResource"]] = None, - gremlin_databases_to_restore: Optional[List["GremlinDatabaseRestoreResource"]] = None, - tables_to_restore: Optional[List[str]] = None, + databases_to_restore: Optional[List["_models.DatabaseRestoreResource"]] = None, **kwargs ): """ - :keyword restore_mode: Describes the mode of the restore. Possible values include: - "PointInTime". + :keyword restore_mode: Describes the mode of the restore. Known values are: "PointInTime". :paramtype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode :keyword restore_source: The id of the restorable database account from which the restore has to be initiated. For example: @@ -11711,156 +8778,12 @@ def __init__( :paramtype restore_timestamp_in_utc: ~datetime.datetime :keyword databases_to_restore: List of specific databases available for restore. :paramtype databases_to_restore: list[~azure.mgmt.cosmosdb.models.DatabaseRestoreResource] - :keyword gremlin_databases_to_restore: List of specific gremlin databases available for - restore. - :paramtype gremlin_databases_to_restore: - list[~azure.mgmt.cosmosdb.models.GremlinDatabaseRestoreResource] - :keyword tables_to_restore: List of specific tables available for restore. - :paramtype tables_to_restore: list[str] """ super(RestoreParameters, self).__init__(**kwargs) self.restore_mode = restore_mode self.restore_source = restore_source self.restore_timestamp_in_utc = restore_timestamp_in_utc self.databases_to_restore = databases_to_restore - self.gremlin_databases_to_restore = gremlin_databases_to_restore - self.tables_to_restore = tables_to_restore - - -class RetrieveThroughputParameters(ARMResourceProperties): - """Cosmos DB retrieve throughput parameters object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: A set of tags. Tags are a list of key-value pairs that describe the resource. These - tags can be used in viewing and grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters - and value no greater than 256 characters. For example, the default experience for a template - type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also - include "Table", "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: Required. The standard JSON format of a resource throughput. - :vartype resource: ~azure.mgmt.cosmosdb.models.RetrieveThroughputPropertiesResource - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'resource': {'key': 'properties.resource', 'type': 'RetrieveThroughputPropertiesResource'}, - } - - def __init__( - self, - *, - resource: "RetrieveThroughputPropertiesResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: A set of tags. Tags are a list of key-value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. For example, the default experience for a - template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values - also include "Table", "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: Required. The standard JSON format of a resource throughput. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RetrieveThroughputPropertiesResource - """ - super(RetrieveThroughputParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - - -class RetrieveThroughputPropertiesResource(msrest.serialization.Model): - """Resource to retrieve throughput information for Cosmos DB resource. - - All required parameters must be populated in order to send to Azure. - - :ivar physical_partition_ids: Required. Array of PhysicalPartitionId objects. - :vartype physical_partition_ids: list[~azure.mgmt.cosmosdb.models.PhysicalPartitionId] - """ - - _validation = { - 'physical_partition_ids': {'required': True}, - } - - _attribute_map = { - 'physical_partition_ids': {'key': 'physicalPartitionIds', 'type': '[PhysicalPartitionId]'}, - } - - def __init__( - self, - *, - physical_partition_ids: List["PhysicalPartitionId"], - **kwargs - ): - """ - :keyword physical_partition_ids: Required. Array of PhysicalPartitionId objects. - :paramtype physical_partition_ids: list[~azure.mgmt.cosmosdb.models.PhysicalPartitionId] - """ - super(RetrieveThroughputPropertiesResource, self).__init__(**kwargs) - self.physical_partition_ids = physical_partition_ids - - -class Role(msrest.serialization.Model): - """The set of roles permitted through this Role Definition. - - :ivar db: The database name the role is applied. - :vartype db: str - :ivar role: The role name. - :vartype role: str - """ - - _attribute_map = { - 'db': {'key': 'db', 'type': 'str'}, - 'role': {'key': 'role', 'type': 'str'}, - } - - def __init__( - self, - *, - db: Optional[str] = None, - role: Optional[str] = None, - **kwargs - ): - """ - :keyword db: The database name the role is applied. - :paramtype db: str - :keyword role: The role name. - :paramtype role: str - """ - super(Role, self).__init__(**kwargs) - self.db = db - self.role = role class SeedNode(msrest.serialization.Model): @@ -11919,7 +8842,7 @@ class ServiceResource(ARMProxyResource): def __init__( self, *, - properties: Optional["ServiceResourceProperties"] = None, + properties: Optional["_models.ServiceResourceProperties"] = None, **kwargs ): """ @@ -11933,13 +8856,13 @@ def __init__( class ServiceResourceCreateUpdateParameters(msrest.serialization.Model): """Parameters for Create or Update Request for ServiceResource. - :ivar instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", + :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", "Cosmos.D16s". :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize :ivar instance_count: Instance count for the service. :vartype instance_count: int - :ivar service_type: ServiceType for the service. Possible values include: - "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", "MaterializedViewsBuilder". + :ivar service_type: ServiceType for the service. Known values are: "SqlDedicatedGateway", + "DataTransfer", "GraphAPICompute", "MaterializedViewsBuilder". :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType """ @@ -11956,19 +8879,19 @@ class ServiceResourceCreateUpdateParameters(msrest.serialization.Model): def __init__( self, *, - instance_size: Optional[Union[str, "ServiceSize"]] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, instance_count: Optional[int] = None, - service_type: Optional[Union[str, "ServiceType"]] = None, + service_type: Optional[Union[str, "_models.ServiceType"]] = None, **kwargs ): """ - :keyword instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", + :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", "Cosmos.D16s". :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize :keyword instance_count: Instance count for the service. :paramtype instance_count: int - :keyword service_type: ServiceType for the service. Possible values include: - "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", "MaterializedViewsBuilder". + :keyword service_type: ServiceType for the service. Known values are: "SqlDedicatedGateway", + "DataTransfer", "GraphAPICompute", "MaterializedViewsBuilder". :paramtype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType """ super(ServiceResourceCreateUpdateParameters, self).__init__(**kwargs) @@ -12023,7 +8946,7 @@ def __init__( self, *, path: Optional[str] = None, - types: Optional[List[Union[str, "SpatialType"]]] = None, + types: Optional[List[Union[str, "_models.SpatialType"]]] = None, **kwargs ): """ @@ -12060,8 +8983,6 @@ class SqlContainerCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: Required. The standard JSON format of a container. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlContainerResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -12082,7 +9003,6 @@ class SqlContainerCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlContainerResource'}, 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } @@ -12090,11 +9010,10 @@ class SqlContainerCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - resource: "SqlContainerResource", + resource: "_models.SqlContainerResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ @@ -12107,15 +9026,13 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: Required. The standard JSON format of a container. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlContainerResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(SqlContainerCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlContainerCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -12139,7 +9056,7 @@ def __init__( self, *, throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, **kwargs ): """ @@ -12174,8 +9091,6 @@ class SqlContainerGetPropertiesResource(ExtendedResourceProperties, SqlContainer :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy :ivar conflict_resolution_policy: The conflict resolution policy for the container. :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - :ivar client_encryption_policy: The client encryption policy for the container. - :vartype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :ivar analytical_storage_ttl: Analytical TTL. :vartype analytical_storage_ttl: long :ivar rid: A system generated property. A unique identifier. @@ -12201,7 +9116,6 @@ class SqlContainerGetPropertiesResource(ExtendedResourceProperties, SqlContainer 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, - 'client_encryption_policy': {'key': 'clientEncryptionPolicy', 'type': 'ClientEncryptionPolicy'}, 'analytical_storage_ttl': {'key': 'analyticalStorageTtl', 'type': 'long'}, 'rid': {'key': '_rid', 'type': 'str'}, 'ts': {'key': '_ts', 'type': 'float'}, @@ -12212,12 +9126,11 @@ def __init__( self, *, id: str, - indexing_policy: Optional["IndexingPolicy"] = None, - partition_key: Optional["ContainerPartitionKey"] = None, + indexing_policy: Optional["_models.IndexingPolicy"] = None, + partition_key: Optional["_models.ContainerPartitionKey"] = None, default_ttl: Optional[int] = None, - unique_key_policy: Optional["UniqueKeyPolicy"] = None, - conflict_resolution_policy: Optional["ConflictResolutionPolicy"] = None, - client_encryption_policy: Optional["ClientEncryptionPolicy"] = None, + unique_key_policy: Optional["_models.UniqueKeyPolicy"] = None, + conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, analytical_storage_ttl: Optional[int] = None, **kwargs ): @@ -12237,19 +9150,16 @@ def __init__( :paramtype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy :keyword conflict_resolution_policy: The conflict resolution policy for the container. :paramtype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - :keyword client_encryption_policy: The client encryption policy for the container. - :paramtype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :keyword analytical_storage_ttl: Analytical TTL. :paramtype analytical_storage_ttl: long """ - super(SqlContainerGetPropertiesResource, self).__init__(id=id, indexing_policy=indexing_policy, partition_key=partition_key, default_ttl=default_ttl, unique_key_policy=unique_key_policy, conflict_resolution_policy=conflict_resolution_policy, client_encryption_policy=client_encryption_policy, analytical_storage_ttl=analytical_storage_ttl, **kwargs) + super(SqlContainerGetPropertiesResource, self).__init__(id=id, indexing_policy=indexing_policy, partition_key=partition_key, default_ttl=default_ttl, unique_key_policy=unique_key_policy, conflict_resolution_policy=conflict_resolution_policy, analytical_storage_ttl=analytical_storage_ttl, **kwargs) self.id = id self.indexing_policy = indexing_policy self.partition_key = partition_key self.default_ttl = default_ttl self.unique_key_policy = unique_key_policy self.conflict_resolution_policy = conflict_resolution_policy - self.client_encryption_policy = client_encryption_policy self.analytical_storage_ttl = analytical_storage_ttl self.rid = None self.ts = None @@ -12276,8 +9186,6 @@ class SqlContainerGetResults(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesResource :ivar options: @@ -12296,7 +9204,6 @@ class SqlContainerGetResults(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlContainerGetPropertiesResource'}, 'options': {'key': 'properties.options', 'type': 'SqlContainerGetPropertiesOptions'}, } @@ -12306,9 +9213,8 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["SqlContainerGetPropertiesResource"] = None, - options: Optional["SqlContainerGetPropertiesOptions"] = None, + resource: Optional["_models.SqlContainerGetPropertiesResource"] = None, + options: Optional["_models.SqlContainerGetPropertiesOptions"] = None, **kwargs ): """ @@ -12321,14 +9227,12 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesOptions """ - super(SqlContainerGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlContainerGetResults, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -12382,8 +9286,6 @@ class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: Required. The standard JSON format of a SQL database. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -12404,7 +9306,6 @@ class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } @@ -12412,11 +9313,10 @@ class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - resource: "SqlDatabaseResource", + resource: "_models.SqlDatabaseResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ @@ -12429,15 +9329,13 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: Required. The standard JSON format of a SQL database. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(SqlDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlDatabaseCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -12461,7 +9359,7 @@ def __init__( self, *, throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, **kwargs ): """ @@ -12561,8 +9459,6 @@ class SqlDatabaseGetResults(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesResource :ivar options: @@ -12581,7 +9477,6 @@ class SqlDatabaseGetResults(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseGetPropertiesResource'}, 'options': {'key': 'properties.options', 'type': 'SqlDatabaseGetPropertiesOptions'}, } @@ -12591,9 +9486,8 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["SqlDatabaseGetPropertiesResource"] = None, - options: Optional["SqlDatabaseGetPropertiesOptions"] = None, + resource: Optional["_models.SqlDatabaseGetPropertiesResource"] = None, + options: Optional["_models.SqlDatabaseGetPropertiesOptions"] = None, **kwargs ): """ @@ -12606,14 +9500,12 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions """ - super(SqlDatabaseGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlDatabaseGetResults, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -12654,8 +9546,8 @@ class SqlDedicatedGatewayRegionalServiceResource(RegionalServiceResource): :vartype name: str :ivar location: The location name. :vartype location: str - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus :ivar sql_dedicated_gateway_endpoint: The regional endpoint for SqlDedicatedGateway. :vartype sql_dedicated_gateway_endpoint: str @@ -12699,7 +9591,7 @@ class SqlDedicatedGatewayServiceResource(msrest.serialization.Model): def __init__( self, *, - properties: Optional["SqlDedicatedGatewayServiceResourceProperties"] = None, + properties: Optional["_models.SqlDedicatedGatewayServiceResourceProperties"] = None, **kwargs ): """ @@ -12722,17 +9614,17 @@ class SqlDedicatedGatewayServiceResourceProperties(ServiceResourceProperties): :vartype additional_properties: dict[str, any] :ivar creation_time: Time of the last state change (ISO-8601 format). :vartype creation_time: ~datetime.datetime - :ivar instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", + :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", "Cosmos.D16s". :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize :ivar instance_count: Instance count for the service. :vartype instance_count: int - :ivar service_type: Required. ServiceType for the service.Constant filled by server. Possible - values include: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", + :ivar service_type: Required. ServiceType for the service.Constant filled by server. Known + values are: "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", "MaterializedViewsBuilder". :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType - :ivar status: Describes the status of a service. Possible values include: "Creating", - "Running", "Updating", "Deleting", "Error", "Stopped". + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", "Stopped". :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus :ivar sql_dedicated_gateway_endpoint: SqlDedicatedGateway endpoint for the service. :vartype sql_dedicated_gateway_endpoint: str @@ -12764,7 +9656,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, Any]] = None, - instance_size: Optional[Union[str, "ServiceSize"]] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, instance_count: Optional[int] = None, sql_dedicated_gateway_endpoint: Optional[str] = None, **kwargs @@ -12773,7 +9665,7 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, any] - :keyword instance_size: Instance type for the service. Possible values include: "Cosmos.D4s", + :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", "Cosmos.D16s". :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize :keyword instance_count: Instance count for the service. @@ -12927,8 +9819,8 @@ class SqlRoleDefinitionCreateUpdateParameters(msrest.serialization.Model): :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database account. :vartype role_name: str - :ivar type: Indicates whether the Role Definition was built-in or user created. Possible values - include: "BuiltInRole", "CustomRole". + :ivar type: Indicates whether the Role Definition was built-in or user created. Known values + are: "BuiltInRole", "CustomRole". :vartype type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType :ivar assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on @@ -12951,17 +9843,17 @@ def __init__( self, *, role_name: Optional[str] = None, - type: Optional[Union[str, "RoleDefinitionType"]] = None, + type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, assignable_scopes: Optional[List[str]] = None, - permissions: Optional[List["Permission"]] = None, + permissions: Optional[List["_models.Permission"]] = None, **kwargs ): """ :keyword role_name: A user-friendly name for the Role Definition. Must be unique for the database account. :paramtype role_name: str - :keyword type: Indicates whether the Role Definition was built-in or user created. Possible - values include: "BuiltInRole", "CustomRole". + :keyword type: Indicates whether the Role Definition was built-in or user created. Known values + are: "BuiltInRole", "CustomRole". :paramtype type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType :keyword assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition @@ -12994,7 +9886,7 @@ class SqlRoleDefinitionGetResults(ARMProxyResource): account. :vartype role_name: str :ivar type_properties_type: Indicates whether the Role Definition was built-in or user created. - Possible values include: "BuiltInRole", "CustomRole". + Known values are: "BuiltInRole", "CustomRole". :vartype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType :ivar assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on @@ -13026,9 +9918,9 @@ def __init__( self, *, role_name: Optional[str] = None, - type_properties_type: Optional[Union[str, "RoleDefinitionType"]] = None, + type_properties_type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, assignable_scopes: Optional[List[str]] = None, - permissions: Optional[List["Permission"]] = None, + permissions: Optional[List["_models.Permission"]] = None, **kwargs ): """ @@ -13036,7 +9928,7 @@ def __init__( database account. :paramtype role_name: str :keyword type_properties_type: Indicates whether the Role Definition was built-in or user - created. Possible values include: "BuiltInRole", "CustomRole". + created. Known values are: "BuiltInRole", "CustomRole". :paramtype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType :keyword assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition @@ -13103,8 +9995,6 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: Required. The standard JSON format of a storedProcedure. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -13125,7 +10015,6 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlStoredProcedureResource'}, 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } @@ -13133,11 +10022,10 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - resource: "SqlStoredProcedureResource", + resource: "_models.SqlStoredProcedureResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ @@ -13150,15 +10038,13 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: Required. The standard JSON format of a storedProcedure. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(SqlStoredProcedureCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlStoredProcedureCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -13277,8 +10163,6 @@ class SqlStoredProcedureGetResults(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetPropertiesResource """ @@ -13295,7 +10179,6 @@ class SqlStoredProcedureGetResults(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlStoredProcedureGetPropertiesResource'}, } @@ -13304,8 +10187,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["SqlStoredProcedureGetPropertiesResource"] = None, + resource: Optional["_models.SqlStoredProcedureGetPropertiesResource"] = None, **kwargs ): """ @@ -13318,12 +10200,10 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetPropertiesResource """ - super(SqlStoredProcedureGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlStoredProcedureGetResults, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource @@ -13376,8 +10256,6 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: Required. The standard JSON format of a trigger. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -13398,7 +10276,6 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlTriggerResource'}, 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } @@ -13406,11 +10283,10 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - resource: "SqlTriggerResource", + resource: "_models.SqlTriggerResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ @@ -13423,15 +10299,13 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: Required. The standard JSON format of a trigger. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(SqlTriggerCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlTriggerCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -13445,10 +10319,10 @@ class SqlTriggerResource(msrest.serialization.Model): :vartype id: str :ivar body: Body of the Trigger. :vartype body: str - :ivar trigger_type: Type of the Trigger. Possible values include: "Pre", "Post". + :ivar trigger_type: Type of the Trigger. Known values are: "Pre", "Post". :vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType - :ivar trigger_operation: The operation the trigger is associated with. Possible values include: - "All", "Create", "Update", "Delete", "Replace". + :ivar trigger_operation: The operation the trigger is associated with. Known values are: "All", + "Create", "Update", "Delete", "Replace". :vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation """ @@ -13468,8 +10342,8 @@ def __init__( *, id: str, body: Optional[str] = None, - trigger_type: Optional[Union[str, "TriggerType"]] = None, - trigger_operation: Optional[Union[str, "TriggerOperation"]] = None, + trigger_type: Optional[Union[str, "_models.TriggerType"]] = None, + trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None, **kwargs ): """ @@ -13477,10 +10351,10 @@ def __init__( :paramtype id: str :keyword body: Body of the Trigger. :paramtype body: str - :keyword trigger_type: Type of the Trigger. Possible values include: "Pre", "Post". + :keyword trigger_type: Type of the Trigger. Known values are: "Pre", "Post". :paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType - :keyword trigger_operation: The operation the trigger is associated with. Possible values - include: "All", "Create", "Update", "Delete", "Replace". + :keyword trigger_operation: The operation the trigger is associated with. Known values are: + "All", "Create", "Update", "Delete", "Replace". :paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation """ super(SqlTriggerResource, self).__init__(**kwargs) @@ -13501,10 +10375,10 @@ class SqlTriggerGetPropertiesResource(ExtendedResourceProperties, SqlTriggerReso :vartype id: str :ivar body: Body of the Trigger. :vartype body: str - :ivar trigger_type: Type of the Trigger. Possible values include: "Pre", "Post". + :ivar trigger_type: Type of the Trigger. Known values are: "Pre", "Post". :vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType - :ivar trigger_operation: The operation the trigger is associated with. Possible values include: - "All", "Create", "Update", "Delete", "Replace". + :ivar trigger_operation: The operation the trigger is associated with. Known values are: "All", + "Create", "Update", "Delete", "Replace". :vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation :ivar rid: A system generated property. A unique identifier. :vartype rid: str @@ -13537,8 +10411,8 @@ def __init__( *, id: str, body: Optional[str] = None, - trigger_type: Optional[Union[str, "TriggerType"]] = None, - trigger_operation: Optional[Union[str, "TriggerOperation"]] = None, + trigger_type: Optional[Union[str, "_models.TriggerType"]] = None, + trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None, **kwargs ): """ @@ -13546,10 +10420,10 @@ def __init__( :paramtype id: str :keyword body: Body of the Trigger. :paramtype body: str - :keyword trigger_type: Type of the Trigger. Possible values include: "Pre", "Post". + :keyword trigger_type: Type of the Trigger. Known values are: "Pre", "Post". :paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType - :keyword trigger_operation: The operation the trigger is associated with. Possible values - include: "All", "Create", "Update", "Delete", "Replace". + :keyword trigger_operation: The operation the trigger is associated with. Known values are: + "All", "Create", "Update", "Delete", "Replace". :paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation """ super(SqlTriggerGetPropertiesResource, self).__init__(id=id, body=body, trigger_type=trigger_type, trigger_operation=trigger_operation, **kwargs) @@ -13582,8 +10456,6 @@ class SqlTriggerGetResults(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerGetPropertiesResource """ @@ -13600,7 +10472,6 @@ class SqlTriggerGetResults(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlTriggerGetPropertiesResource'}, } @@ -13609,8 +10480,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["SqlTriggerGetPropertiesResource"] = None, + resource: Optional["_models.SqlTriggerGetPropertiesResource"] = None, **kwargs ): """ @@ -13623,12 +10493,10 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerGetPropertiesResource """ - super(SqlTriggerGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlTriggerGetResults, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource @@ -13681,8 +10549,6 @@ class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: Required. The standard JSON format of a userDefinedFunction. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -13703,7 +10569,6 @@ class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlUserDefinedFunctionResource'}, 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } @@ -13711,11 +10576,10 @@ class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - resource: "SqlUserDefinedFunctionResource", + resource: "_models.SqlUserDefinedFunctionResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ @@ -13728,15 +10592,13 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: Required. The standard JSON format of a userDefinedFunction. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(SqlUserDefinedFunctionCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlUserDefinedFunctionCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -13855,8 +10717,6 @@ class SqlUserDefinedFunctionGetResults(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetPropertiesResource """ @@ -13873,7 +10733,6 @@ class SqlUserDefinedFunctionGetResults(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'SqlUserDefinedFunctionGetPropertiesResource'}, } @@ -13882,8 +10741,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["SqlUserDefinedFunctionGetPropertiesResource"] = None, + resource: Optional["_models.SqlUserDefinedFunctionGetPropertiesResource"] = None, **kwargs ): """ @@ -13896,12 +10754,10 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetPropertiesResource """ - super(SqlUserDefinedFunctionGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(SqlUserDefinedFunctionGetResults, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource @@ -13937,15 +10793,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime @@ -13964,25 +10820,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime @@ -14018,8 +10874,6 @@ class TableCreateUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: Required. The standard JSON format of a Table. :vartype resource: ~azure.mgmt.cosmosdb.models.TableResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -14040,7 +10894,6 @@ class TableCreateUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'TableResource'}, 'options': {'key': 'properties.options', 'type': 'CreateUpdateOptions'}, } @@ -14048,11 +10901,10 @@ class TableCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - resource: "TableResource", + resource: "_models.TableResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - options: Optional["CreateUpdateOptions"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs ): """ @@ -14065,15 +10917,13 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: Required. The standard JSON format of a Table. :paramtype resource: ~azure.mgmt.cosmosdb.models.TableResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super(TableCreateUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(TableCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -14097,7 +10947,7 @@ def __init__( self, *, throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettings"] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, **kwargs ): """ @@ -14210,8 +11060,6 @@ class TableGetResults(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource :ivar options: @@ -14230,7 +11078,6 @@ class TableGetResults(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'TableGetPropertiesResource'}, 'options': {'key': 'properties.options', 'type': 'TableGetPropertiesOptions'}, } @@ -14240,9 +11087,8 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["TableGetPropertiesResource"] = None, - options: Optional["TableGetPropertiesOptions"] = None, + resource: Optional["_models.TableGetPropertiesResource"] = None, + options: Optional["_models.TableGetPropertiesOptions"] = None, **kwargs ): """ @@ -14255,14 +11101,12 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions """ - super(TableGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(TableGetResults, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -14361,7 +11205,7 @@ def __init__( self, *, throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettingsResource"] = None, + autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None, **kwargs ): """ @@ -14425,7 +11269,7 @@ def __init__( self, *, throughput: Optional[int] = None, - autoscale_settings: Optional["AutoscaleSettingsResource"] = None, + autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None, **kwargs ): """ @@ -14466,8 +11310,6 @@ class ThroughputSettingsGetResults(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource """ @@ -14484,7 +11326,6 @@ class ThroughputSettingsGetResults(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'ThroughputSettingsGetPropertiesResource'}, } @@ -14493,8 +11334,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - resource: Optional["ThroughputSettingsGetPropertiesResource"] = None, + resource: Optional["_models.ThroughputSettingsGetPropertiesResource"] = None, **kwargs ): """ @@ -14507,12 +11347,10 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource """ - super(ThroughputSettingsGetResults, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(ThroughputSettingsGetResults, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource @@ -14538,8 +11376,6 @@ class ThroughputSettingsUpdateParameters(ARMResourceProperties): type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: Required. The standard JSON format of a resource throughput. :vartype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource """ @@ -14557,17 +11393,15 @@ class ThroughputSettingsUpdateParameters(ARMResourceProperties): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'resource': {'key': 'properties.resource', 'type': 'ThroughputSettingsResource'}, } def __init__( self, *, - resource: "ThroughputSettingsResource", + resource: "_models.ThroughputSettingsResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, **kwargs ): """ @@ -14580,12 +11414,10 @@ def __init__( template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: Required. The standard JSON format of a resource throughput. :paramtype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource """ - super(ThroughputSettingsUpdateParameters, self).__init__(location=location, tags=tags, identity=identity, **kwargs) + super(ThroughputSettingsUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.resource = resource @@ -14629,7 +11461,7 @@ class UniqueKeyPolicy(msrest.serialization.Model): def __init__( self, *, - unique_keys: Optional[List["UniqueKey"]] = None, + unique_keys: Optional[List["_models.UniqueKey"]] = None, **kwargs ): """ diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py index 5839e9432833..4dc3387907c0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py @@ -19,14 +19,12 @@ from ._collection_partition_operations import CollectionPartitionOperations from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations -from ._graph_resources_operations import GraphResourcesOperations from ._sql_resources_operations import SqlResourcesOperations from ._mongo_db_resources_operations import MongoDBResourcesOperations from ._table_resources_operations import TableResourcesOperations from ._cassandra_resources_operations import CassandraResourcesOperations from ._gremlin_resources_operations import GremlinResourcesOperations from ._locations_operations import LocationsOperations -from ._data_transfer_jobs_operations import DataTransferJobsOperations from ._cassandra_clusters_operations import CassandraClustersOperations from ._cassandra_data_centers_operations import CassandraDataCentersOperations from ._notebook_workspaces_operations import NotebookWorkspacesOperations @@ -39,13 +37,11 @@ from ._restorable_mongodb_databases_operations import RestorableMongodbDatabasesOperations from ._restorable_mongodb_collections_operations import RestorableMongodbCollectionsOperations from ._restorable_mongodb_resources_operations import RestorableMongodbResourcesOperations -from ._restorable_gremlin_databases_operations import RestorableGremlinDatabasesOperations -from ._restorable_gremlin_graphs_operations import RestorableGremlinGraphsOperations -from ._restorable_gremlin_resources_operations import RestorableGremlinResourcesOperations -from ._restorable_tables_operations import RestorableTablesOperations -from ._restorable_table_resources_operations import RestorableTableResourcesOperations from ._service_operations import ServiceOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'DatabaseAccountsOperations', 'Operations', @@ -60,14 +56,12 @@ 'CollectionPartitionOperations', 'PartitionKeyRangeIdOperations', 'PartitionKeyRangeIdRegionOperations', - 'GraphResourcesOperations', 'SqlResourcesOperations', 'MongoDBResourcesOperations', 'TableResourcesOperations', 'CassandraResourcesOperations', 'GremlinResourcesOperations', 'LocationsOperations', - 'DataTransferJobsOperations', 'CassandraClustersOperations', 'CassandraDataCentersOperations', 'NotebookWorkspacesOperations', @@ -80,10 +74,7 @@ 'RestorableMongodbDatabasesOperations', 'RestorableMongodbCollectionsOperations', 'RestorableMongodbResourcesOperations', - 'RestorableGremlinDatabasesOperations', - 'RestorableGremlinGraphsOperations', - 'RestorableGremlinResourcesOperations', - 'RestorableTablesOperations', - 'RestorableTableResourcesOperations', 'ServiceOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_clusters_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_clusters_operations.py index 6177b1baff5b..9b53a487c057 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_clusters_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_clusters_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -137,9 +140,12 @@ def build_delete_request_initial( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -151,18 +157,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -172,14 +176,17 @@ def build_create_update_request_initial( resource_group_name: str, cluster_name: str, *, - json: JSONType = None, + json: Optional[_models.ClusterResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -191,20 +198,18 @@ def build_create_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -216,14 +221,17 @@ def build_update_request_initial( resource_group_name: str, cluster_name: str, *, - json: JSONType = None, + json: Optional[_models.ClusterResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -235,20 +243,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -260,14 +266,17 @@ def build_invoke_command_request_initial( resource_group_name: str, cluster_name: str, *, - json: JSONType = None, + json: Optional[_models.CommandPostBody] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -279,109 +288,36 @@ def build_invoke_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -def build_list_backups_request( - subscription_id: str, - resource_group_name: str, - cluster_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str', max_length=100, min_length=1, pattern=r'^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_backup_request( - subscription_id: str, - resource_group_name: str, - cluster_name: str, - backup_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str', max_length=100, min_length=1, pattern=r'^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$'), - "backupId": _SERIALIZER.url("backup_id", backup_id, 'str', max_length=15, min_length=1, pattern=r'^[0-9]+$'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - def build_deallocate_request_initial( subscription_id: str, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate") # pylint: disable=line-too-long path_format_arguments = { @@ -393,18 +329,16 @@ def build_deallocate_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -415,9 +349,12 @@ def build_start_request_initial( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -429,18 +366,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -451,9 +386,12 @@ def build_status_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status") # pylint: disable=line-too-long path_format_arguments = { @@ -465,48 +403,44 @@ def build_status_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class CassandraClustersOperations(object): - """CassandraClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class CassandraClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`cassandra_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_subscription( self, **kwargs: Any - ) -> Iterable["_models.ListClusters"]: + ) -> Iterable[_models.ListClusters]: """List all managed Cassandra clusters in this subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -514,13 +448,16 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ListClusters] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ListClusters] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListClusters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -528,9 +465,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -538,9 +477,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -578,7 +519,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ListClusters"]: + ) -> Iterable[_models.ListClusters]: """List all managed Cassandra clusters in this resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -588,13 +529,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ListClusters] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ListClusters] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListClusters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -603,9 +547,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -614,9 +560,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -655,7 +603,7 @@ def get( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ClusterResource": + ) -> _models.ClusterResource: """Get the properties of a managed Cassandra cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -667,13 +615,16 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.ClusterResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] request = build_get_request( @@ -682,11 +633,13 @@ def get( cluster_name=cluster_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -713,13 +666,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -728,11 +684,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements cluster_name=cluster_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -774,20 +732,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -797,8 +760,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -815,17 +784,20 @@ def _create_update_initial( self, resource_group_name: str, cluster_name: str, - body: "_models.ClusterResource", + body: _models.ClusterResource, **kwargs: Any - ) -> "_models.ClusterResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] + ) -> _models.ClusterResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] _json = self._serialize.body(body, 'ClusterResource') @@ -837,11 +809,13 @@ def _create_update_initial( content_type=content_type, json=_json, template_url=self._create_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -871,9 +845,9 @@ def begin_create_update( self, resource_group_name: str, cluster_name: str, - body: "_models.ClusterResource", + body: _models.ClusterResource, **kwargs: Any - ) -> LROPoller["_models.ClusterResource"]: + ) -> LROPoller[_models.ClusterResource]: """Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update only some properties, use PATCH. @@ -896,37 +870,47 @@ def begin_create_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_initial( + raw_result = self._create_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ClusterResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -943,17 +927,20 @@ def _update_initial( self, resource_group_name: str, cluster_name: str, - body: "_models.ClusterResource", + body: _models.ClusterResource, **kwargs: Any - ) -> "_models.ClusterResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] + ) -> _models.ClusterResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] _json = self._serialize.body(body, 'ClusterResource') @@ -965,11 +952,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -999,9 +988,9 @@ def begin_update( self, resource_group_name: str, cluster_name: str, - body: "_models.ClusterResource", + body: _models.ClusterResource, **kwargs: Any - ) -> LROPoller["_models.ClusterResource"]: + ) -> LROPoller[_models.ClusterResource]: """Updates some of the properties of a managed Cassandra cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1023,37 +1012,47 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ClusterResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1070,17 +1069,20 @@ def _invoke_command_initial( self, resource_group_name: str, cluster_name: str, - body: "_models.CommandPostBody", + body: _models.CommandPostBody, **kwargs: Any - ) -> "_models.CommandOutput": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CommandOutput"] + ) -> _models.CommandOutput: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CommandOutput] _json = self._serialize.body(body, 'CommandPostBody') @@ -1092,11 +1094,13 @@ def _invoke_command_initial( content_type=content_type, json=_json, template_url=self._invoke_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1122,9 +1126,9 @@ def begin_invoke_command( self, resource_group_name: str, cluster_name: str, - body: "_models.CommandPostBody", + body: _models.CommandPostBody, **kwargs: Any - ) -> LROPoller["_models.CommandOutput"]: + ) -> LROPoller[_models.CommandOutput]: """Invoke a command like nodetool for cassandra maintenance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1146,37 +1150,47 @@ def begin_invoke_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CommandOutput] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CommandOutput"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._invoke_command_initial( + raw_result = self._invoke_command_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CommandOutput', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1189,162 +1203,22 @@ def get_long_running_output(pipeline_response): begin_invoke_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand"} # type: ignore - @distributed_trace - def list_backups( - self, - resource_group_name: str, - cluster_name: str, - **kwargs: Any - ) -> Iterable["_models.ListBackups"]: - """List the backups of this cluster that are available to restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBackups or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ListBackups] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBackups"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_backups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - cluster_name=cluster_name, - api_version=api_version, - template_url=self.list_backups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_backups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - cluster_name=cluster_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ListBackups", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_backups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups"} # type: ignore - - @distributed_trace - def get_backup( - self, - resource_group_name: str, - cluster_name: str, - backup_id: str, - **kwargs: Any - ) -> "_models.BackupResource": - """Get the properties of an individual backup of this cluster that is available to restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. - :type cluster_name: str - :param backup_id: Id of a restorable backup of a Cassandra cluster. - :type backup_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResource, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.BackupResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_backup_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - cluster_name=cluster_name, - backup_id=backup_id, - api_version=api_version, - template_url=self.get_backup.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BackupResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_backup.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}"} # type: ignore - - def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_deallocate_request_initial( @@ -1353,11 +1227,13 @@ def _deallocate_initial( # pylint: disable=inconsistent-return-statements cluster_name=cluster_name, api_version=api_version, template_url=self._deallocate_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1401,20 +1277,25 @@ def begin_deallocate( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._deallocate_initial( + raw_result = self._deallocate_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1424,8 +1305,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1444,13 +1331,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1459,11 +1349,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements cluster_name=cluster_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1507,20 +1399,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1530,8 +1427,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1550,7 +1453,7 @@ def status( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.CassandraClusterPublicStatus": + ) -> _models.CassandraClusterPublicStatus: """Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1562,13 +1465,16 @@ def status( :rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraClusterPublicStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraClusterPublicStatus] request = build_status_request( @@ -1577,11 +1483,13 @@ def status( cluster_name=cluster_name, api_version=api_version, template_url=self.status.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_data_centers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_data_centers_operations.py index e5d916ffdb19..bc5dc16cdabb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_data_centers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_data_centers_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( data_center_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -110,9 +112,12 @@ def build_delete_request_initial( data_center_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -125,18 +130,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -147,14 +150,17 @@ def build_create_update_request_initial( cluster_name: str, data_center_name: str, *, - json: JSONType = None, + json: Optional[_models.DataCenterResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -167,20 +173,18 @@ def build_create_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -193,14 +197,17 @@ def build_update_request_initial( cluster_name: str, data_center_name: str, *, - json: JSONType = None, + json: Optional[_models.DataCenterResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -213,46 +220,42 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class CassandraDataCentersOperations(object): - """CassandraDataCentersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class CassandraDataCentersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`cassandra_data_centers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -260,7 +263,7 @@ def list( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.ListDataCenters"]: + ) -> Iterable[_models.ListDataCenters]: """List all data centers in a particular managed Cassandra cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -272,13 +275,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ListDataCenters] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ListDataCenters] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListDataCenters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -288,9 +294,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -300,9 +308,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -342,7 +352,7 @@ def get( cluster_name: str, data_center_name: str, **kwargs: Any - ) -> "_models.DataCenterResource": + ) -> _models.DataCenterResource: """Get the properties of a managed Cassandra data center. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -356,13 +366,16 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] request = build_get_request( @@ -372,11 +385,13 @@ def get( data_center_name=data_center_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -404,13 +419,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements data_center_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -420,11 +438,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements data_center_name=data_center_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -469,21 +489,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -493,8 +518,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -512,17 +543,20 @@ def _create_update_initial( resource_group_name: str, cluster_name: str, data_center_name: str, - body: "_models.DataCenterResource", + body: _models.DataCenterResource, **kwargs: Any - ) -> "_models.DataCenterResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] + ) -> _models.DataCenterResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] _json = self._serialize.body(body, 'DataCenterResource') @@ -535,11 +569,13 @@ def _create_update_initial( content_type=content_type, json=_json, template_url=self._create_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -570,9 +606,9 @@ def begin_create_update( resource_group_name: str, cluster_name: str, data_center_name: str, - body: "_models.DataCenterResource", + body: _models.DataCenterResource, **kwargs: Any - ) -> LROPoller["_models.DataCenterResource"]: + ) -> LROPoller[_models.DataCenterResource]: """Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some properties, use PATCH. @@ -597,17 +633,20 @@ def begin_create_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_initial( + raw_result = self._create_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, @@ -615,20 +654,27 @@ def begin_create_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DataCenterResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -646,17 +692,20 @@ def _update_initial( resource_group_name: str, cluster_name: str, data_center_name: str, - body: "_models.DataCenterResource", + body: _models.DataCenterResource, **kwargs: Any - ) -> "_models.DataCenterResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] + ) -> _models.DataCenterResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] _json = self._serialize.body(body, 'DataCenterResource') @@ -669,11 +718,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -704,9 +755,9 @@ def begin_update( resource_group_name: str, cluster_name: str, data_center_name: str, - body: "_models.DataCenterResource", + body: _models.DataCenterResource, **kwargs: Any - ) -> LROPoller["_models.DataCenterResource"]: + ) -> LROPoller[_models.DataCenterResource]: """Update some of the properties of a managed Cassandra data center. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -730,17 +781,20 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataCenterResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCenterResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, @@ -748,20 +802,27 @@ def begin_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DataCenterResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( 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 c29258edcc9a..37a7b1b7b4c1 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_cassandra_keyspaces_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_cassandra_keyspaces_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_cassandra_keyspace_request( keyspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_cassandra_keyspace_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_update_cassandra_keyspace_request_initial( account_name: str, keyspace_name: str, *, - json: JSONType = None, + json: Optional[_models.CassandraKeyspaceCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_update_cassandra_keyspace_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,8 +159,9 @@ def build_delete_cassandra_keyspace_request_initial( keyspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,13 +174,12 @@ def build_delete_cassandra_keyspace_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -188,9 +191,12 @@ def build_get_cassandra_keyspace_throughput_request( keyspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -203,18 +209,16 @@ def build_get_cassandra_keyspace_throughput_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -225,14 +229,17 @@ def build_update_cassandra_keyspace_throughput_request_initial( account_name: str, keyspace_name: str, *, - json: JSONType = None, + json: Optional[_models.ThroughputSettingsUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -245,20 +252,18 @@ def build_update_cassandra_keyspace_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -272,9 +277,12 @@ def build_migrate_cassandra_keyspace_to_autoscale_request_initial( keyspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long path_format_arguments = { @@ -287,18 +295,16 @@ def build_migrate_cassandra_keyspace_to_autoscale_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -310,9 +316,12 @@ def build_migrate_cassandra_keyspace_to_manual_throughput_request_initial( keyspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long path_format_arguments = { @@ -325,18 +334,16 @@ def build_migrate_cassandra_keyspace_to_manual_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -348,9 +355,12 @@ def build_list_cassandra_tables_request( keyspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables") # pylint: disable=line-too-long path_format_arguments = { @@ -363,18 +373,16 @@ def build_list_cassandra_tables_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -387,9 +395,12 @@ def build_get_cassandra_table_request( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") # pylint: disable=line-too-long path_format_arguments = { @@ -403,18 +414,16 @@ def build_get_cassandra_table_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -426,14 +435,17 @@ def build_create_update_cassandra_table_request_initial( keyspace_name: str, table_name: str, *, - json: JSONType = None, + json: Optional[_models.CassandraTableCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") # pylint: disable=line-too-long path_format_arguments = { @@ -447,20 +459,18 @@ def build_create_update_cassandra_table_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -475,8 +485,9 @@ def build_delete_cassandra_table_request_initial( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") # pylint: disable=line-too-long path_format_arguments = { @@ -490,13 +501,12 @@ def build_delete_cassandra_table_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -509,9 +519,12 @@ def build_get_cassandra_table_throughput_request( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -525,18 +538,16 @@ def build_get_cassandra_table_throughput_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -548,14 +559,17 @@ def build_update_cassandra_table_throughput_request_initial( keyspace_name: str, table_name: str, *, - json: JSONType = None, + json: Optional[_models.ThroughputSettingsUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -569,20 +583,18 @@ def build_update_cassandra_table_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -597,9 +609,12 @@ def build_migrate_cassandra_table_to_autoscale_request_initial( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long path_format_arguments = { @@ -613,18 +628,16 @@ def build_migrate_cassandra_table_to_autoscale_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -637,9 +650,12 @@ def build_migrate_cassandra_table_to_manual_throughput_request_initial( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long path_format_arguments = { @@ -653,370 +669,38 @@ def build_migrate_cassandra_table_to_manual_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_cassandra_views_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_cassandra_view_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, 'str'), - "viewName": _SERIALIZER.url("view_name", view_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_update_cassandra_view_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, 'str'), - "viewName": _SERIALIZER.url("view_name", view_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_cassandra_view_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, 'str'), - "viewName": _SERIALIZER.url("view_name", view_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - **kwargs - ) - - -def build_get_cassandra_view_throughput_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, 'str'), - "viewName": _SERIALIZER.url("view_name", view_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_cassandra_view_throughput_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, 'str'), - "viewName": _SERIALIZER.url("view_name", view_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_migrate_cassandra_view_to_autoscale_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, 'str'), - "viewName": _SERIALIZER.url("view_name", view_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_migrate_cassandra_view_to_manual_throughput_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, 'str'), - "viewName": _SERIALIZER.url("view_name", view_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class CassandraResourcesOperations(object): # pylint: disable=too-many-public-methods - """CassandraResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class CassandraResourcesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`cassandra_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_cassandra_keyspaces( @@ -1024,7 +708,7 @@ def list_cassandra_keyspaces( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.CassandraKeyspaceListResult"]: + ) -> 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. @@ -1037,13 +721,16 @@ def list_cassandra_keyspaces( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1053,9 +740,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_cassandra_keyspaces.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1065,9 +754,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1107,7 +798,7 @@ def get_cassandra_keyspace( account_name: str, keyspace_name: str, **kwargs: Any - ) -> "_models.CassandraKeyspaceGetResults": + ) -> _models.CassandraKeyspaceGetResults: """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. @@ -1122,13 +813,16 @@ def get_cassandra_keyspace( :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraKeyspaceGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraKeyspaceGetResults] request = build_get_cassandra_keyspace_request( @@ -1138,11 +832,13 @@ def get_cassandra_keyspace( keyspace_name=keyspace_name, api_version=api_version, template_url=self.get_cassandra_keyspace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1168,17 +864,20 @@ 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: Any - ) -> Optional["_models.CassandraKeyspaceGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CassandraKeyspaceGetResults"]] + ) -> Optional[_models.CassandraKeyspaceGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.CassandraKeyspaceGetResults]] _json = self._serialize.body(create_update_cassandra_keyspace_parameters, 'CassandraKeyspaceCreateUpdateParameters') @@ -1191,11 +890,13 @@ def _create_update_cassandra_keyspace_initial( content_type=content_type, json=_json, template_url=self._create_update_cassandra_keyspace_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1224,9 +925,9 @@ 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: Any - ) -> LROPoller["_models.CassandraKeyspaceGetResults"]: + ) -> 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. @@ -1252,17 +953,20 @@ def begin_create_update_cassandra_keyspace( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraKeyspaceGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraKeyspaceGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_cassandra_keyspace_initial( + raw_result = self._create_update_cassandra_keyspace_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -1270,858 +974,27 @@ def begin_create_update_cassandra_keyspace( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CassandraKeyspaceGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_cassandra_keyspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore - - def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_delete_cassandra_keyspace_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - template_url=self._delete_cassandra_keyspace_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_cassandra_keyspace_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore - - - @distributed_trace - def begin_delete_cassandra_keyspace( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra keyspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_cassandra_keyspace_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_cassandra_keyspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore - - @distributed_trace - def get_cassandra_keyspace_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": - """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database - account with the provided name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ThroughputSettingsGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_cassandra_keyspace_throughput_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - template_url=self.get_cassandra_keyspace_throughput.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_cassandra_keyspace_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore - - - def _update_cassandra_keyspace_throughput_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') - - request = build_update_cassandra_keyspace_throughput_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_cassandra_keyspace_throughput_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_cassandra_keyspace_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore - - - @distributed_trace - def begin_update_cassandra_keyspace_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_cassandra_keyspace_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - update_throughput_parameters=update_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_cassandra_keyspace_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore - - def _migrate_cassandra_keyspace_to_autoscale_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_migrate_cassandra_keyspace_to_autoscale_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - template_url=self._migrate_cassandra_keyspace_to_autoscale_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_cassandra_keyspace_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - - @distributed_trace - def begin_migrate_cassandra_keyspace_to_autoscale( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._migrate_cassandra_keyspace_to_autoscale_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_cassandra_keyspace_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - def _migrate_cassandra_keyspace_to_manual_throughput_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_migrate_cassandra_keyspace_to_manual_throughput_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - template_url=self._migrate_cassandra_keyspace_to_manual_throughput_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_cassandra_keyspace_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - - @distributed_trace - def begin_migrate_cassandra_keyspace_to_manual_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._migrate_cassandra_keyspace_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_cassandra_keyspace_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - @distributed_trace - def list_cassandra_tables( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CassandraTableListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraTableListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, - request = build_list_cassandra_tables_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - template_url=self.list_cassandra_tables.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - request = build_list_cassandra_tables_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CassandraTableListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_cassandra_tables.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables"} # type: ignore - - @distributed_trace - def get_cassandra_table( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - table_name: str, - **kwargs: Any - ) -> "_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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param table_name: Cosmos DB table name. - :type table_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CassandraTableGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_cassandra_table_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - api_version=api_version, - template_url=self.get_cassandra_table.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CassandraTableGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_cassandra_table.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore - - - def _create_update_cassandra_table_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: "_models.CassandraTableCreateUpdateParameters", - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(create_update_cassandra_table_parameters, 'CassandraTableCreateUpdateParameters') - - request = build_create_update_cassandra_table_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_update_cassandra_table_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CassandraTableGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_cassandra_table_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore - - - @distributed_trace - def begin_create_update_cassandra_table( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: "_models.CassandraTableCreateUpdateParameters", - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. - :type keyspace_name: str - :param table_name: Cosmos DB table name. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. - :type create_update_cassandra_table_parameters: - ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 CassandraTableGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraTableGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_update_cassandra_table_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CassandraTableGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2132,38 +1005,41 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_update_cassandra_table.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + begin_create_update_cassandra_keyspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore - def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-statements + def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - request = build_delete_cassandra_table_request_initial( + request = build_delete_cassandra_keyspace_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, - template_url=self._delete_cassandra_table_initial.metadata['url'], + template_url=self._delete_cassandra_keyspace_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2177,19 +1053,18 @@ def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - _delete_cassandra_table_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + _delete_cassandra_keyspace_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore @distributed_trace - def begin_delete_cassandra_table( # pylint: disable=inconsistent-return-statements + def begin_delete_cassandra_keyspace( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra table. + """Deletes an existing Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -2197,8 +1072,6 @@ def begin_delete_cassandra_table( # pylint: disable=inconsistent-return-stateme :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param table_name: Cosmos DB table name. - :type table_name: str :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -2211,22 +1084,26 @@ def begin_delete_cassandra_table( # pylint: disable=inconsistent-return-stateme :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_cassandra_table_initial( + raw_result = self._delete_cassandra_keyspace_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2236,8 +1113,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2248,18 +1131,17 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_cassandra_table.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + begin_delete_cassandra_keyspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore @distributed_trace - def get_cassandra_table_throughput( + def get_cassandra_keyspace_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": - """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2268,35 +1150,37 @@ def get_cassandra_table_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param table_name: Cosmos DB table name. - :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ThroughputSettingsGetResults, or the result of cls(response) :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] - request = build_get_cassandra_table_throughput_request( + request = build_get_cassandra_keyspace_throughput_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, - template_url=self.get_cassandra_table_throughput.metadata['url'], + template_url=self.get_cassandra_keyspace_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2314,44 +1198,47 @@ def get_cassandra_table_throughput( return deserialized - get_cassandra_table_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore + get_cassandra_keyspace_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore - def _update_cassandra_table_throughput_initial( + def _update_cassandra_keyspace_throughput_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') - request = build_update_cassandra_table_throughput_request_initial( + request = build_update_cassandra_keyspace_throughput_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_cassandra_table_throughput_initial.metadata['url'], + template_url=self._update_cassandra_keyspace_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2371,20 +1258,19 @@ def _update_cassandra_table_throughput_initial( return deserialized - _update_cassandra_table_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore + _update_cassandra_keyspace_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore @distributed_trace - def begin_update_cassandra_table_throughput( + def begin_update_cassandra_keyspace_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + ) -> 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. :type resource_group_name: str @@ -2392,10 +1278,8 @@ def begin_update_cassandra_table_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param table_name: Cosmos DB table name. - :type table_name: str :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. + current Cassandra Keyspace. :type update_throughput_parameters: ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2411,39 +1295,48 @@ def begin_update_cassandra_table_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_cassandra_table_throughput_initial( + raw_result = self._update_cassandra_keyspace_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, update_throughput_parameters=update_throughput_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2454,38 +1347,41 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_cassandra_table_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore + begin_update_cassandra_keyspace_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore - def _migrate_cassandra_table_to_autoscale_initial( + def _migrate_cassandra_keyspace_to_autoscale_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - request = build_migrate_cassandra_table_to_autoscale_request_initial( + request = build_migrate_cassandra_keyspace_to_autoscale_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, - template_url=self._migrate_cassandra_table_to_autoscale_initial.metadata['url'], + template_url=self._migrate_cassandra_keyspace_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2505,19 +1401,18 @@ def _migrate_cassandra_table_to_autoscale_initial( return deserialized - _migrate_cassandra_table_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_cassandra_keyspace_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale"} # type: ignore @distributed_trace - def begin_migrate_cassandra_table_to_autoscale( + def begin_migrate_cassandra_keyspace_to_autoscale( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + ) -> 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. :type resource_group_name: str @@ -2525,8 +1420,6 @@ def begin_migrate_cassandra_table_to_autoscale( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param table_name: Cosmos DB table name. - :type table_name: str :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -2540,36 +1433,45 @@ def begin_migrate_cassandra_table_to_autoscale( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_cassandra_table_to_autoscale_initial( + raw_result = self._migrate_cassandra_keyspace_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2580,38 +1482,41 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_cassandra_table_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_cassandra_keyspace_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - def _migrate_cassandra_table_to_manual_throughput_initial( + def _migrate_cassandra_keyspace_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - request = build_migrate_cassandra_table_to_manual_throughput_request_initial( + request = build_migrate_cassandra_keyspace_to_manual_throughput_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, - template_url=self._migrate_cassandra_table_to_manual_throughput_initial.metadata['url'], + template_url=self._migrate_cassandra_keyspace_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2631,19 +1536,18 @@ def _migrate_cassandra_table_to_manual_throughput_initial( return deserialized - _migrate_cassandra_table_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_cassandra_keyspace_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace - def begin_migrate_cassandra_table_to_manual_throughput( + def begin_migrate_cassandra_keyspace_to_manual_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + ) -> 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. :type resource_group_name: str @@ -2651,8 +1555,6 @@ def begin_migrate_cassandra_table_to_manual_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param table_name: Cosmos DB table name. - :type table_name: str :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -2666,36 +1568,45 @@ def begin_migrate_cassandra_table_to_manual_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_cassandra_table_to_manual_throughput_initial( + raw_result = self._migrate_cassandra_keyspace_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2706,17 +1617,17 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_cassandra_table_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_cassandra_keyspace_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace - def list_cassandra_views( + def list_cassandra_tables( self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> Iterable["_models.CassandraViewListResult"]: - """Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. + ) -> 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. :type resource_group_name: str @@ -2725,49 +1636,56 @@ def list_cassandra_views( :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CassandraViewListResult or the result of + :return: An iterator like instance of either CassandraTableListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraTableListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraViewListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - request = build_list_cassandra_views_request( + request = build_list_cassandra_tables_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, api_version=api_version, - template_url=self.list_cassandra_views.metadata['url'], + template_url=self.list_cassandra_tables.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - request = build_list_cassandra_views_request( + request = build_list_cassandra_tables_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize("CassandraViewListResult", pipeline_response) + deserialized = self._deserialize("CassandraTableListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -2793,18 +1711,18 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_cassandra_views.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views"} # type: ignore + list_cassandra_tables.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables"} # type: ignore @distributed_trace - def get_cassandra_view( + def get_cassandra_table( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, **kwargs: Any - ) -> "_models.CassandraViewGetResults": - """Gets the Cassandra view under an existing Azure Cosmos DB database account. + ) -> _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. :type resource_group_name: str @@ -2812,35 +1730,40 @@ def get_cassandra_view( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str + :param table_name: Cosmos DB table name. + :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CassandraViewGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults + :return: CassandraTableGetResults, or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraViewGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraTableGetResults] - request = build_get_cassandra_view_request( + request = build_get_cassandra_table_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, - template_url=self.get_cassandra_view.metadata['url'], + template_url=self.get_cassandra_table.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2851,51 +1774,56 @@ def get_cassandra_view( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CassandraViewGetResults', pipeline_response) + deserialized = self._deserialize('CassandraTableGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_cassandra_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + get_cassandra_table.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore - def _create_update_cassandra_view_initial( + def _create_update_cassandra_table_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: "_models.CassandraViewCreateUpdateParameters", + table_name: str, + create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters, **kwargs: Any - ) -> Optional["_models.CassandraViewGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CassandraViewGetResults"]] + ) -> Optional[_models.CassandraTableGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(create_update_cassandra_view_parameters, 'CassandraViewCreateUpdateParameters') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.CassandraTableGetResults]] + + _json = self._serialize.body(create_update_cassandra_table_parameters, 'CassandraTableCreateUpdateParameters') - request = build_create_update_cassandra_view_request_initial( + request = build_create_update_cassandra_table_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_update_cassandra_view_initial.metadata['url'], + template_url=self._create_update_cassandra_table_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2908,27 +1836,27 @@ def _create_update_cassandra_view_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('CassandraViewGetResults', pipeline_response) + deserialized = self._deserialize('CassandraTableGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_update_cassandra_view_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + _create_update_cassandra_table_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore @distributed_trace - def begin_create_update_cassandra_view( + def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: "_models.CassandraViewCreateUpdateParameters", + table_name: str, + create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.CassandraViewGetResults"]: - """Create or update an Azure Cosmos DB Cassandra View. + ) -> 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. :type resource_group_name: str @@ -2936,12 +1864,12 @@ def begin_create_update_cassandra_view( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str - :param create_update_cassandra_view_parameters: The parameters to provide for the current - Cassandra View. - :type create_update_cassandra_view_parameters: - ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters + :param table_name: Cosmos DB table name. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -2950,44 +1878,54 @@ def begin_create_update_cassandra_view( :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 CassandraViewGetResults or the result of + :return: An instance of LROPoller that returns either CassandraTableGetResults or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CassandraTableGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CassandraViewGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_cassandra_view_initial( + raw_result = self._create_update_cassandra_table_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, - create_update_cassandra_view_parameters=create_update_cassandra_view_parameters, + table_name=table_name, + create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CassandraViewGetResults', pipeline_response) + deserialized = self._deserialize('CassandraTableGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2998,64 +1936,69 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_update_cassandra_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + begin_create_update_cassandra_table.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore - def _delete_cassandra_view_initial( # pylint: disable=inconsistent-return-statements + def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - request = build_delete_cassandra_view_request_initial( + request = build_delete_cassandra_table_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, - template_url=self._delete_cassandra_view_initial.metadata['url'], + template_url=self._delete_cassandra_table_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_cassandra_view_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + _delete_cassandra_table_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore @distributed_trace - def begin_delete_cassandra_view( # pylint: disable=inconsistent-return-statements + def begin_delete_cassandra_table( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra view. + """Deletes an existing Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -3063,8 +2006,8 @@ def begin_delete_cassandra_view( # pylint: disable=inconsistent-return-statemen :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str + :param table_name: Cosmos DB table name. + :type table_name: str :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -3077,22 +2020,27 @@ def begin_delete_cassandra_view( # pylint: disable=inconsistent-return-statemen :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_cassandra_view_initial( + raw_result = self._delete_cassandra_table_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -3102,8 +2050,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3114,18 +2068,18 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_cassandra_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + begin_delete_cassandra_table.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore @distributed_trace - def get_cassandra_view_throughput( + def get_cassandra_table_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": - """Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3134,35 +2088,40 @@ def get_cassandra_view_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str + :param table_name: Cosmos DB table name. + :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ThroughputSettingsGetResults, or the result of cls(response) :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] - request = build_get_cassandra_view_throughput_request( + request = build_get_cassandra_table_throughput_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, - template_url=self.get_cassandra_view_throughput.metadata['url'], + template_url=self.get_cassandra_table_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3180,44 +2139,49 @@ def get_cassandra_view_throughput( return deserialized - get_cassandra_view_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore + get_cassandra_table_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore - def _update_cassandra_view_throughput_initial( + def _update_cassandra_table_throughput_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", + table_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') - request = build_update_cassandra_view_throughput_request_initial( + request = build_update_cassandra_table_throughput_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_cassandra_view_throughput_initial.metadata['url'], + template_url=self._update_cassandra_table_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3237,20 +2201,20 @@ def _update_cassandra_view_throughput_initial( return deserialized - _update_cassandra_view_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore + _update_cassandra_table_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore @distributed_trace - def begin_update_cassandra_view_throughput( + def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", + table_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: - """Update RUs per second of an Azure Cosmos DB Cassandra view. + ) -> 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. :type resource_group_name: str @@ -3258,10 +2222,10 @@ def begin_update_cassandra_view_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str + :param table_name: Cosmos DB table name. + :type table_name: str :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra view. + current Cassandra table. :type update_throughput_parameters: ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -3277,39 +2241,49 @@ def begin_update_cassandra_view_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_cassandra_view_throughput_initial( + raw_result = self._update_cassandra_table_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, update_throughput_parameters=update_throughput_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3320,38 +2294,43 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_cassandra_view_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore + begin_update_cassandra_table_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore - def _migrate_cassandra_view_to_autoscale_initial( + def _migrate_cassandra_table_to_autoscale_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - request = build_migrate_cassandra_view_to_autoscale_request_initial( + request = build_migrate_cassandra_table_to_autoscale_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, - template_url=self._migrate_cassandra_view_to_autoscale_initial.metadata['url'], + template_url=self._migrate_cassandra_table_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3371,19 +2350,19 @@ def _migrate_cassandra_view_to_autoscale_initial( return deserialized - _migrate_cassandra_view_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_cassandra_table_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore @distributed_trace - def begin_migrate_cassandra_view_to_autoscale( + def begin_migrate_cassandra_table_to_autoscale( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale. + ) -> 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. :type resource_group_name: str @@ -3391,8 +2370,8 @@ def begin_migrate_cassandra_view_to_autoscale( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str + :param table_name: Cosmos DB table name. + :type table_name: str :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -3406,36 +2385,46 @@ def begin_migrate_cassandra_view_to_autoscale( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_cassandra_view_to_autoscale_initial( + raw_result = self._migrate_cassandra_table_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3446,38 +2435,43 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_cassandra_view_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_cassandra_table_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - def _migrate_cassandra_view_to_manual_throughput_initial( + def _migrate_cassandra_table_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - request = build_migrate_cassandra_view_to_manual_throughput_request_initial( + request = build_migrate_cassandra_table_to_manual_throughput_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, - template_url=self._migrate_cassandra_view_to_manual_throughput_initial.metadata['url'], + template_url=self._migrate_cassandra_table_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3497,19 +2491,19 @@ def _migrate_cassandra_view_to_manual_throughput_initial( return deserialized - _migrate_cassandra_view_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_cassandra_table_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace - def begin_migrate_cassandra_view_to_manual_throughput( + def begin_migrate_cassandra_table_to_manual_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput. + ) -> 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. :type resource_group_name: str @@ -3517,8 +2511,8 @@ def begin_migrate_cassandra_view_to_manual_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. :type keyspace_name: str - :param view_name: Cosmos DB view name. - :type view_name: str + :param table_name: Cosmos DB table name. + :type table_name: str :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -3532,36 +2526,46 @@ def begin_migrate_cassandra_view_to_manual_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_cassandra_view_to_manual_throughput_initial( + raw_result = self._migrate_cassandra_table_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3572,4 +2576,4 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_cassandra_view_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_cassandra_table_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore 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 b6f34022143e..0a89f60be96b 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -36,9 +37,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -52,19 +56,17 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -79,9 +81,12 @@ def build_list_usages_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages") # pylint: disable=line-too-long path_format_arguments = { @@ -95,20 +100,18 @@ def build_list_usages_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -121,9 +124,12 @@ def build_list_metric_definitions_request( collection_rid: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions") # pylint: disable=line-too-long path_format_arguments = { @@ -137,42 +143,38 @@ def build_list_metric_definitions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class CollectionOperations(object): - """CollectionOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class CollectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`collection` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -183,7 +185,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs: Any - ) -> Iterable["_models.MetricListResult"]: + ) -> Iterable[_models.MetricListResult]: """Retrieves the metrics determined by the given filter for the given database account and collection. @@ -204,13 +206,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -223,9 +228,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -238,9 +245,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -282,7 +291,7 @@ def list_usages( collection_rid: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.UsagesResult"]: + ) -> 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. @@ -302,13 +311,16 @@ def list_usages( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -321,9 +333,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -336,9 +350,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -379,7 +395,7 @@ def list_metric_definitions( database_rid: str, collection_rid: str, **kwargs: Any - ) -> Iterable["_models.MetricDefinitionsListResult"]: + ) -> 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. @@ -396,13 +412,16 @@ def list_metric_definitions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -414,9 +433,11 @@ def prepare_request(next_link=None): collection_rid=collection_rid, api_version=api_version, template_url=self.list_metric_definitions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -428,9 +449,11 @@ def prepare_request(next_link=None): collection_rid=collection_rid, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 1241c6e54dc3..ceee064d4bb6 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -36,9 +37,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -52,19 +56,17 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -79,9 +81,12 @@ def build_list_usages_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages") # pylint: disable=line-too-long path_format_arguments = { @@ -95,44 +100,40 @@ def build_list_usages_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class CollectionPartitionOperations(object): - """CollectionPartitionOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class CollectionPartitionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`collection_partition` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -143,7 +144,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs: Any - ) -> Iterable["_models.PartitionMetricListResult"]: + ) -> Iterable[_models.PartitionMetricListResult]: """Retrieves the metrics determined by the given filter for the given collection, split by partition. @@ -165,13 +166,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -184,9 +188,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -199,9 +205,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -243,7 +251,7 @@ def list_usages( collection_rid: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.PartitionUsagesResult"]: + ) -> 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. @@ -264,13 +272,16 @@ def list_usages( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -283,9 +294,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -298,9 +311,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 ad8b0f115f32..176360b3ec63 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -37,9 +38,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -54,43 +58,39 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class CollectionPartitionRegionOperations(object): - """CollectionPartitionRegionOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class CollectionPartitionRegionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`collection_partition_region` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -102,7 +102,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs: Any - ) -> Iterable["_models.PartitionMetricListResult"]: + ) -> Iterable[_models.PartitionMetricListResult]: """Retrieves the metrics determined by the given filter for the given collection and region, split by partition. @@ -126,13 +126,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -146,9 +149,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -162,9 +167,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 2862ac157067..18f489a21d52 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -37,9 +38,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -54,43 +58,39 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class CollectionRegionOperations(object): - """CollectionRegionOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class CollectionRegionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`collection_region` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -102,7 +102,7 @@ def list_metrics( collection_rid: str, filter: str, **kwargs: Any - ) -> Iterable["_models.MetricListResult"]: + ) -> Iterable[_models.MetricListResult]: """Retrieves the metrics determined by the given filter for the given database account, collection and region. @@ -125,13 +125,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -145,9 +148,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -161,9 +166,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_data_transfer_jobs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_data_transfer_jobs_operations.py deleted file mode 100644 index 105971c0052c..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_data_transfer_jobs_operations.py +++ /dev/null @@ -1,682 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_create_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - job_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "jobName": _SERIALIZER.url("job_name", job_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "jobName": _SERIALIZER.url("job_name", job_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_pause_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/pause") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "jobName": _SERIALIZER.url("job_name", job_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_resume_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/resume") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "jobName": _SERIALIZER.url("job_name", job_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_cancel_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/cancel") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "jobName": _SERIALIZER.url("job_name", job_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_by_database_account_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class DataTransferJobsOperations(object): - """DataTransferJobsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def create( - self, - resource_group_name: str, - account_name: str, - job_name: str, - job_create_parameters: "_models.CreateJobRequest", - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Creates a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :param job_create_parameters: - :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(job_create_parameters, 'CreateJobRequest') - - request = build_create_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}"} # type: ignore - - - @distributed_trace - def get( - self, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Get a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}"} # type: ignore - - - @distributed_trace - def pause( - self, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Pause a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_pause_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - template_url=self.pause.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - pause.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/pause"} # type: ignore - - - @distributed_trace - def resume( - self, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Resumes a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_resume_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - template_url=self.resume.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - resume.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/resume"} # type: ignore - - - @distributed_trace - def cancel( - self, - resource_group_name: str, - account_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.DataTransferJobGetResults": - """Cancels a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param job_name: Name of the Data Transfer Job. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_cancel_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - api_version=api_version, - template_url=self.cancel.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataTransferJobGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/cancel"} # type: ignore - - - @distributed_trace - def list_by_database_account( - self, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> Iterable["_models.DataTransferJobFeedResults"]: - """Get a list of Data Transfer jobs. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataTransferJobFeedResults or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobFeedResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataTransferJobFeedResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_database_account_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.list_by_database_account.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_database_account_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DataTransferJobFeedResults", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_by_database_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs"} # type: ignore 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 7291d463b69f..9c6d1b18923a 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -35,9 +36,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -50,43 +54,39 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class DatabaseAccountRegionOperations(object): - """DatabaseAccountRegionOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class DatabaseAccountRegionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`database_account_region` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -96,7 +96,7 @@ def list_metrics( region: str, filter: str, **kwargs: Any - ) -> Iterable["_models.MetricListResult"]: + ) -> 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. @@ -114,13 +114,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -132,9 +135,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -146,9 +151,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 32ec1177aa57..641e9d5dd50e 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_get_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,14 +71,17 @@ def build_update_request_initial( resource_group_name: str, account_name: str, *, - json: JSONType = None, + json: Optional[_models.DatabaseAccountUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") # pylint: disable=line-too-long path_format_arguments = { @@ -89,20 +93,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -114,14 +116,17 @@ def build_create_or_update_request_initial( resource_group_name: str, account_name: str, *, - json: JSONType = None, + json: Optional[_models.DatabaseAccountCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") # pylint: disable=line-too-long path_format_arguments = { @@ -133,20 +138,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -159,8 +162,9 @@ def build_delete_request_initial( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") # pylint: disable=line-too-long path_format_arguments = { @@ -172,13 +176,12 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -188,13 +191,15 @@ def build_failover_priority_change_request_initial( resource_group_name: str, account_name: str, *, - json: JSONType = None, + json: Optional[_models.FailoverPolicies] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange") # pylint: disable=line-too-long path_format_arguments = { @@ -206,19 +211,17 @@ def build_failover_priority_change_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -229,9 +232,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts") path_format_arguments = { @@ -241,18 +247,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -262,9 +266,12 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts") # pylint: disable=line-too-long path_format_arguments = { @@ -275,18 +282,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -297,9 +302,12 @@ def build_list_keys_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys") # pylint: disable=line-too-long path_format_arguments = { @@ -311,18 +319,16 @@ def build_list_keys_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -333,9 +339,12 @@ def build_list_connection_strings_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings") # pylint: disable=line-too-long path_format_arguments = { @@ -347,18 +356,16 @@ def build_list_connection_strings_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -368,14 +375,17 @@ def build_offline_region_request_initial( resource_group_name: str, account_name: str, *, - json: JSONType = None, + json: Optional[_models.RegionForOnlineOffline] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion") # pylint: disable=line-too-long path_format_arguments = { @@ -387,20 +397,18 @@ def build_offline_region_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -412,14 +420,17 @@ def build_online_region_request_initial( resource_group_name: str, account_name: str, *, - json: JSONType = None, + json: Optional[_models.RegionForOnlineOffline] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion") # pylint: disable=line-too-long path_format_arguments = { @@ -431,20 +442,18 @@ def build_online_region_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -457,9 +466,12 @@ def build_get_read_only_keys_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys") # pylint: disable=line-too-long path_format_arguments = { @@ -471,18 +483,16 @@ def build_get_read_only_keys_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -493,9 +503,12 @@ def build_list_read_only_keys_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys") # pylint: disable=line-too-long path_format_arguments = { @@ -507,18 +520,16 @@ def build_list_read_only_keys_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -528,13 +539,15 @@ def build_regenerate_key_request_initial( resource_group_name: str, account_name: str, *, - json: JSONType = None, + json: Optional[_models.DatabaseAccountRegenerateKeyParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey") # pylint: disable=line-too-long path_format_arguments = { @@ -546,19 +559,17 @@ def build_regenerate_key_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -569,8 +580,9 @@ def build_check_name_exists_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}") path_format_arguments = { @@ -580,13 +592,12 @@ def build_check_name_exists_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="HEAD", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -599,9 +610,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -613,19 +627,17 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -638,9 +650,12 @@ def build_list_usages_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages") # pylint: disable=line-too-long path_format_arguments = { @@ -652,20 +667,18 @@ def build_list_usages_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -676,9 +689,12 @@ def build_list_metric_definitions_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions") # pylint: disable=line-too-long path_format_arguments = { @@ -690,42 +706,38 @@ def build_list_metric_definitions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class DatabaseAccountsOperations(object): # pylint: disable=too-many-public-methods - """DatabaseAccountsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`database_accounts` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def get( @@ -733,7 +745,7 @@ def get( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -745,13 +757,16 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] request = build_get_request( @@ -760,11 +775,13 @@ def get( account_name=account_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -789,17 +806,20 @@ def _update_initial( self, resource_group_name: str, account_name: str, - update_parameters: "_models.DatabaseAccountUpdateParameters", + update_parameters: _models.DatabaseAccountUpdateParameters, **kwargs: Any - ) -> "_models.DatabaseAccountGetResults": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] + ) -> _models.DatabaseAccountGetResults: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] _json = self._serialize.body(update_parameters, 'DatabaseAccountUpdateParameters') @@ -811,11 +831,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -841,9 +863,9 @@ def begin_update( self, resource_group_name: str, account_name: str, - update_parameters: "_models.DatabaseAccountUpdateParameters", + update_parameters: _models.DatabaseAccountUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.DatabaseAccountGetResults"]: + ) -> 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. @@ -865,37 +887,47 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, update_parameters=update_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DatabaseAccountGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -912,17 +944,20 @@ def _create_or_update_initial( self, resource_group_name: str, account_name: str, - create_update_parameters: "_models.DatabaseAccountCreateUpdateParameters", + create_update_parameters: _models.DatabaseAccountCreateUpdateParameters, **kwargs: Any - ) -> "_models.DatabaseAccountGetResults": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] + ) -> _models.DatabaseAccountGetResults: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] _json = self._serialize.body(create_update_parameters, 'DatabaseAccountCreateUpdateParameters') @@ -934,11 +969,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -964,9 +1001,9 @@ def begin_create_or_update( self, resource_group_name: str, account_name: str, - create_update_parameters: "_models.DatabaseAccountCreateUpdateParameters", + create_update_parameters: _models.DatabaseAccountCreateUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.DatabaseAccountGetResults"]: + ) -> LROPoller[_models.DatabaseAccountGetResults]: """Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. @@ -990,37 +1027,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, create_update_parameters=create_update_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DatabaseAccountGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1039,13 +1086,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements account_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1054,11 +1104,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements account_name=account_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1100,20 +1152,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1123,8 +1180,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1141,17 +1204,20 @@ def _failover_priority_change_initial( # pylint: disable=inconsistent-return-st self, resource_group_name: str, account_name: str, - failover_parameters: "_models.FailoverPolicies", + failover_parameters: _models.FailoverPolicies, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(failover_parameters, 'FailoverPolicies') @@ -1163,11 +1229,13 @@ def _failover_priority_change_initial( # pylint: disable=inconsistent-return-st content_type=content_type, json=_json, template_url=self._failover_priority_change_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1189,7 +1257,7 @@ def begin_failover_priority_change( # pylint: disable=inconsistent-return-state self, resource_group_name: str, account_name: str, - failover_parameters: "_models.FailoverPolicies", + failover_parameters: _models.FailoverPolicies, **kwargs: Any ) -> LROPoller[None]: """Changes the failover priority for the Azure Cosmos DB database account. A failover priority of @@ -1215,23 +1283,28 @@ def begin_failover_priority_change( # pylint: disable=inconsistent-return-state :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._failover_priority_change_initial( + raw_result = self._failover_priority_change_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, failover_parameters=failover_parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1241,8 +1314,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1259,7 +1338,7 @@ def get_long_running_output(pipeline_response): def list( self, **kwargs: Any - ) -> Iterable["_models.DatabaseAccountsListResult"]: + ) -> 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 @@ -1268,13 +1347,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1282,9 +1364,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1292,9 +1376,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1332,7 +1418,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.DatabaseAccountsListResult"]: + ) -> 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. @@ -1343,13 +1429,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1358,9 +1447,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1369,9 +1460,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1410,7 +1503,7 @@ def list_keys( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -1422,13 +1515,16 @@ def list_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountListKeysResult] request = build_list_keys_request( @@ -1437,11 +1533,13 @@ def list_keys( account_name=account_name, api_version=api_version, template_url=self.list_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1468,7 +1566,7 @@ def list_connection_strings( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -1480,13 +1578,16 @@ def list_connection_strings( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListConnectionStringsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseAccountListConnectionStringsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountListConnectionStringsResult] request = build_list_connection_strings_request( @@ -1495,11 +1596,13 @@ def list_connection_strings( account_name=account_name, api_version=api_version, template_url=self.list_connection_strings.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1524,17 +1627,20 @@ def _offline_region_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, - region_parameter_for_offline: "_models.RegionForOnlineOffline", + region_parameter_for_offline: _models.RegionForOnlineOffline, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(region_parameter_for_offline, 'RegionForOnlineOffline') @@ -1546,11 +1652,13 @@ def _offline_region_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._offline_region_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1572,7 +1680,7 @@ def begin_offline_region( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, - region_parameter_for_offline: "_models.RegionForOnlineOffline", + region_parameter_for_offline: _models.RegionForOnlineOffline, **kwargs: Any ) -> LROPoller[None]: """Offline the specified region for the specified Azure Cosmos DB database account. @@ -1595,23 +1703,28 @@ def begin_offline_region( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._offline_region_initial( + raw_result = self._offline_region_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, region_parameter_for_offline=region_parameter_for_offline, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1621,8 +1734,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1639,17 +1758,20 @@ def _online_region_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, - region_parameter_for_online: "_models.RegionForOnlineOffline", + region_parameter_for_online: _models.RegionForOnlineOffline, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(region_parameter_for_online, 'RegionForOnlineOffline') @@ -1661,11 +1783,13 @@ def _online_region_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._online_region_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1687,7 +1811,7 @@ def begin_online_region( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, - region_parameter_for_online: "_models.RegionForOnlineOffline", + region_parameter_for_online: _models.RegionForOnlineOffline, **kwargs: Any ) -> LROPoller[None]: """Online the specified region for the specified Azure Cosmos DB database account. @@ -1710,23 +1834,28 @@ def begin_online_region( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._online_region_initial( + raw_result = self._online_region_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, region_parameter_for_online=region_parameter_for_online, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1736,8 +1865,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1756,7 +1891,7 @@ def get_read_only_keys( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -1768,13 +1903,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] request = build_get_read_only_keys_request( @@ -1783,11 +1921,13 @@ def get_read_only_keys( account_name=account_name, api_version=api_version, template_url=self.get_read_only_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1814,7 +1954,7 @@ def list_read_only_keys( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_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. @@ -1826,13 +1966,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] request = build_list_read_only_keys_request( @@ -1841,11 +1984,13 @@ def list_read_only_keys( account_name=account_name, api_version=api_version, template_url=self.list_read_only_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1870,17 +2015,20 @@ def _regenerate_key_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, - key_to_regenerate: "_models.DatabaseAccountRegenerateKeyParameters", + key_to_regenerate: _models.DatabaseAccountRegenerateKeyParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(key_to_regenerate, 'DatabaseAccountRegenerateKeyParameters') @@ -1892,11 +2040,13 @@ def _regenerate_key_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._regenerate_key_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1918,7 +2068,7 @@ def begin_regenerate_key( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, - key_to_regenerate: "_models.DatabaseAccountRegenerateKeyParameters", + key_to_regenerate: _models.DatabaseAccountRegenerateKeyParameters, **kwargs: Any ) -> LROPoller[None]: """Regenerates an access key for the specified Azure Cosmos DB database account. @@ -1941,23 +2091,28 @@ def begin_regenerate_key( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._regenerate_key_initial( + raw_result = self._regenerate_key_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, key_to_regenerate=key_to_regenerate, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1967,8 +2122,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1998,24 +2159,29 @@ def check_name_exists( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_check_name_exists_request( account_name=account_name, api_version=api_version, template_url=self.check_name_exists.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2040,7 +2206,7 @@ def list_metrics( account_name: str, filter: str, **kwargs: Any - ) -> Iterable["_models.MetricListResult"]: + ) -> 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. @@ -2056,13 +2222,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2073,9 +2242,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2086,9 +2257,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -2128,7 +2301,7 @@ def list_usages( account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.UsagesResult"]: + ) -> 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. @@ -2144,13 +2317,16 @@ def list_usages( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2161,9 +2337,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2174,9 +2352,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -2215,7 +2395,7 @@ def list_metric_definitions( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.MetricDefinitionsListResult"]: + ) -> 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. @@ -2228,13 +2408,16 @@ def list_metric_definitions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2244,9 +2427,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_metric_definitions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2256,9 +2441,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 58111a46e3fe..fd2d5772752f 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -35,9 +36,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -50,19 +54,17 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -76,9 +78,12 @@ def build_list_usages_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages") # pylint: disable=line-too-long path_format_arguments = { @@ -91,20 +96,18 @@ def build_list_usages_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -116,9 +119,12 @@ def build_list_metric_definitions_request( database_rid: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions") # pylint: disable=line-too-long path_format_arguments = { @@ -131,42 +137,38 @@ def build_list_metric_definitions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class DatabaseOperations(object): - """DatabaseOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class DatabaseOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`database` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -176,7 +178,7 @@ def list_metrics( database_rid: str, filter: str, **kwargs: Any - ) -> Iterable["_models.MetricListResult"]: + ) -> Iterable[_models.MetricListResult]: """Retrieves the metrics determined by the given filter for the given database account and database. @@ -195,13 +197,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -213,9 +218,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -227,9 +234,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -270,7 +279,7 @@ def list_usages( database_rid: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.UsagesResult"]: + ) -> 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. @@ -288,13 +297,16 @@ def list_usages( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.UsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -306,9 +318,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -320,9 +334,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -362,7 +378,7 @@ def list_metric_definitions( account_name: str, database_rid: str, **kwargs: Any - ) -> Iterable["_models.MetricDefinitionsListResult"]: + ) -> 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. @@ -377,13 +393,16 @@ def list_metric_definitions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinitionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -394,9 +413,11 @@ def prepare_request(next_link=None): database_rid=database_rid, api_version=api_version, template_url=self.list_metric_definitions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -407,9 +428,11 @@ def prepare_request(next_link=None): database_rid=database_rid, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_graph_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_graph_resources_operations.py deleted file mode 100644 index 97dcafd9c031..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_graph_resources_operations.py +++ /dev/null @@ -1,590 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_graphs_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_graph_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - graph_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "graphName": _SERIALIZER.url("graph_name", graph_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_update_graph_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - graph_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "graphName": _SERIALIZER.url("graph_name", graph_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_graph_resource_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - graph_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "graphName": _SERIALIZER.url("graph_name", graph_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - **kwargs - ) - -class GraphResourcesOperations(object): - """GraphResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_graphs( - self, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> Iterable["_models.GraphResourcesListResult"]: - """Lists the graphs under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GraphResourcesListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GraphResourcesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.GraphResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_graphs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.list_graphs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_graphs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GraphResourcesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_graphs.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs"} # type: ignore - - @distributed_trace - def get_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - **kwargs: Any - ) -> "_models.GraphResourceGetResults": - """Gets the Graph resource 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. - :type graph_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GraphResourceGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.GraphResourceGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GraphResourceGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_graph_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - template_url=self.get_graph.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GraphResourceGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_graph.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - - def _create_update_graph_initial( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: "_models.GraphResourceCreateUpdateParameters", - **kwargs: Any - ) -> Optional["_models.GraphResourceGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GraphResourceGetResults"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(create_update_graph_parameters, 'GraphResourceCreateUpdateParameters') - - request = build_create_update_graph_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_update_graph_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('GraphResourceGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_graph_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - - @distributed_trace - def begin_create_update_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: "_models.GraphResourceCreateUpdateParameters", - **kwargs: Any - ) -> LROPoller["_models.GraphResourceGetResults"]: - """Create or update an Azure Cosmos DB Graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. - :type graph_name: str - :param create_update_graph_parameters: The parameters to provide for the current graph. - :type create_update_graph_parameters: - ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 GraphResourceGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GraphResourceGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_update_graph_initial( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - create_update_graph_parameters=create_update_graph_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('GraphResourceGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_graph.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - def _delete_graph_resource_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - graph_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_delete_graph_resource_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - template_url=self._delete_graph_resource_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_graph_resource_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - - @distributed_trace - def begin_delete_graph_resource( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - graph_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Graph Resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. - :type graph_name: str - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_graph_resource_initial( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_graph_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore 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 ee7a57ea451e..c460668636e7 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_gremlin_databases_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_gremlin_databases_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_gremlin_database_request( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_gremlin_database_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_update_gremlin_database_request_initial( account_name: str, database_name: str, *, - json: JSONType = None, + json: Optional[_models.GremlinDatabaseCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_update_gremlin_database_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,8 +159,9 @@ def build_delete_gremlin_database_request_initial( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,13 +174,12 @@ def build_delete_gremlin_database_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -188,9 +191,12 @@ def build_get_gremlin_database_throughput_request( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -203,18 +209,16 @@ def build_get_gremlin_database_throughput_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -225,14 +229,17 @@ def build_update_gremlin_database_throughput_request_initial( account_name: str, database_name: str, *, - json: JSONType = None, + json: Optional[_models.ThroughputSettingsUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -245,20 +252,18 @@ def build_update_gremlin_database_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -272,9 +277,12 @@ def build_migrate_gremlin_database_to_autoscale_request_initial( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long path_format_arguments = { @@ -287,18 +295,16 @@ def build_migrate_gremlin_database_to_autoscale_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -310,9 +316,12 @@ def build_migrate_gremlin_database_to_manual_throughput_request_initial( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long path_format_arguments = { @@ -325,18 +334,16 @@ def build_migrate_gremlin_database_to_manual_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -348,9 +355,12 @@ def build_list_gremlin_graphs_request( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs") # pylint: disable=line-too-long path_format_arguments = { @@ -363,18 +373,16 @@ def build_list_gremlin_graphs_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -387,9 +395,12 @@ def build_get_gremlin_graph_request( graph_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") # pylint: disable=line-too-long path_format_arguments = { @@ -403,18 +414,16 @@ def build_get_gremlin_graph_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -426,14 +435,17 @@ def build_create_update_gremlin_graph_request_initial( database_name: str, graph_name: str, *, - json: JSONType = None, + json: Optional[_models.GremlinGraphCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") # pylint: disable=line-too-long path_format_arguments = { @@ -447,20 +459,18 @@ def build_create_update_gremlin_graph_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -475,8 +485,9 @@ def build_delete_gremlin_graph_request_initial( graph_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") # pylint: disable=line-too-long path_format_arguments = { @@ -490,13 +501,12 @@ def build_delete_gremlin_graph_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -509,9 +519,12 @@ def build_get_gremlin_graph_throughput_request( graph_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -525,18 +538,16 @@ def build_get_gremlin_graph_throughput_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -548,14 +559,17 @@ def build_update_gremlin_graph_throughput_request_initial( database_name: str, graph_name: str, *, - json: JSONType = None, + json: Optional[_models.ThroughputSettingsUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -569,20 +583,18 @@ def build_update_gremlin_graph_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -597,9 +609,12 @@ def build_migrate_gremlin_graph_to_autoscale_request_initial( graph_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long path_format_arguments = { @@ -613,18 +628,16 @@ def build_migrate_gremlin_graph_to_autoscale_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -637,55 +650,14 @@ def build_migrate_gremlin_graph_to_manual_throughput_request_initial( graph_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "graphName": _SERIALIZER.url("graph_name", graph_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") -def build_retrieve_continuous_backup_information_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -697,46 +669,38 @@ def build_retrieve_continuous_backup_information_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, + params=_params, + headers=_headers, **kwargs ) -class GremlinResourcesOperations(object): # pylint: disable=too-many-public-methods - """GremlinResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class GremlinResourcesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`gremlin_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_gremlin_databases( @@ -744,7 +708,7 @@ def list_gremlin_databases( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.GremlinDatabaseListResult"]: + ) -> 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. @@ -757,13 +721,16 @@ def list_gremlin_databases( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -773,9 +740,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_gremlin_databases.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -785,9 +754,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -827,7 +798,7 @@ def get_gremlin_database( account_name: str, database_name: str, **kwargs: Any - ) -> "_models.GremlinDatabaseGetResults": + ) -> _models.GremlinDatabaseGetResults: """Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. @@ -842,13 +813,16 @@ def get_gremlin_database( :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinDatabaseGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.GremlinDatabaseGetResults] request = build_get_gremlin_database_request( @@ -858,11 +832,13 @@ def get_gremlin_database( database_name=database_name, api_version=api_version, template_url=self.get_gremlin_database.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -888,17 +864,20 @@ 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: Any - ) -> Optional["_models.GremlinDatabaseGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GremlinDatabaseGetResults"]] + ) -> Optional[_models.GremlinDatabaseGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.GremlinDatabaseGetResults]] _json = self._serialize.body(create_update_gremlin_database_parameters, 'GremlinDatabaseCreateUpdateParameters') @@ -911,11 +890,13 @@ def _create_update_gremlin_database_initial( content_type=content_type, json=_json, template_url=self._create_update_gremlin_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -944,9 +925,9 @@ 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: Any - ) -> LROPoller["_models.GremlinDatabaseGetResults"]: + ) -> 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. @@ -972,17 +953,20 @@ def begin_create_update_gremlin_database( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.GremlinDatabaseGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_gremlin_database_initial( + raw_result = self._create_update_gremlin_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -990,20 +974,27 @@ def begin_create_update_gremlin_database( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GremlinDatabaseGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1023,13 +1014,16 @@ def _delete_gremlin_database_initial( # pylint: disable=inconsistent-return-sta database_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_gremlin_database_request_initial( @@ -1039,11 +1033,13 @@ def _delete_gremlin_database_initial( # pylint: disable=inconsistent-return-sta database_name=database_name, api_version=api_version, template_url=self._delete_gremlin_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1088,21 +1084,26 @@ def begin_delete_gremlin_database( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_gremlin_database_initial( + raw_result = self._delete_gremlin_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1112,8 +1113,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1133,7 +1140,7 @@ def get_gremlin_database_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> "_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. @@ -1148,13 +1155,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_gremlin_database_throughput_request( @@ -1164,11 +1174,13 @@ def get_gremlin_database_throughput( database_name=database_name, api_version=api_version, template_url=self.get_gremlin_database_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1194,17 +1206,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -1217,11 +1232,13 @@ def _update_gremlin_database_throughput_initial( content_type=content_type, json=_json, template_url=self._update_gremlin_database_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1250,9 +1267,9 @@ 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: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -1278,17 +1295,20 @@ def begin_update_gremlin_database_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_gremlin_database_throughput_initial( + raw_result = self._update_gremlin_database_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1296,20 +1316,27 @@ def begin_update_gremlin_database_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1328,14 +1355,17 @@ def _migrate_gremlin_database_to_autoscale_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_gremlin_database_to_autoscale_request_initial( @@ -1345,11 +1375,13 @@ def _migrate_gremlin_database_to_autoscale_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_gremlin_database_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1379,7 +1411,7 @@ def begin_migrate_gremlin_database_to_autoscale( account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -1401,35 +1433,45 @@ def begin_migrate_gremlin_database_to_autoscale( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_gremlin_database_to_autoscale_initial( + raw_result = self._migrate_gremlin_database_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1448,14 +1490,17 @@ def _migrate_gremlin_database_to_manual_throughput_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_gremlin_database_to_manual_throughput_request_initial( @@ -1465,11 +1510,13 @@ def _migrate_gremlin_database_to_manual_throughput_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_gremlin_database_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1499,7 +1546,7 @@ def begin_migrate_gremlin_database_to_manual_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -1521,35 +1568,45 @@ def begin_migrate_gremlin_database_to_manual_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_gremlin_database_to_manual_throughput_initial( + raw_result = self._migrate_gremlin_database_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1569,7 +1626,7 @@ def list_gremlin_graphs( account_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.GremlinGraphListResult"]: + ) -> 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. @@ -1584,13 +1641,16 @@ def list_gremlin_graphs( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1601,9 +1661,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=self.list_gremlin_graphs.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1614,9 +1676,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1657,7 +1721,7 @@ def get_gremlin_graph( database_name: str, graph_name: str, **kwargs: Any - ) -> "_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. @@ -1673,13 +1737,16 @@ def get_gremlin_graph( :rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinGraphGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.GremlinGraphGetResults] request = build_get_gremlin_graph_request( @@ -1690,11 +1757,13 @@ def get_gremlin_graph( graph_name=graph_name, api_version=api_version, template_url=self.get_gremlin_graph.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1721,17 +1790,20 @@ 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: Any - ) -> Optional["_models.GremlinGraphGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GremlinGraphGetResults"]] + ) -> Optional[_models.GremlinGraphGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.GremlinGraphGetResults]] _json = self._serialize.body(create_update_gremlin_graph_parameters, 'GremlinGraphCreateUpdateParameters') @@ -1745,11 +1817,13 @@ def _create_update_gremlin_graph_initial( content_type=content_type, json=_json, template_url=self._create_update_gremlin_graph_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1779,9 +1853,9 @@ 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: Any - ) -> LROPoller["_models.GremlinGraphGetResults"]: + ) -> 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. @@ -1809,17 +1883,20 @@ def begin_create_update_gremlin_graph( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.GremlinGraphGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GremlinGraphGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_gremlin_graph_initial( + raw_result = self._create_update_gremlin_graph_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1828,20 +1905,27 @@ def begin_create_update_gremlin_graph( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GremlinGraphGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1862,13 +1946,16 @@ def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return-statem graph_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_gremlin_graph_request_initial( @@ -1879,11 +1966,13 @@ def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return-statem graph_name=graph_name, api_version=api_version, template_url=self._delete_gremlin_graph_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1931,22 +2020,27 @@ def begin_delete_gremlin_graph( # pylint: disable=inconsistent-return-statement :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_gremlin_graph_initial( + raw_result = self._delete_gremlin_graph_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, graph_name=graph_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1956,8 +2050,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1978,7 +2078,7 @@ def get_gremlin_graph_throughput( database_name: str, graph_name: str, **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": + ) -> _models.ThroughputSettingsGetResults: """Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. @@ -1995,13 +2095,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_gremlin_graph_throughput_request( @@ -2012,11 +2115,13 @@ def get_gremlin_graph_throughput( graph_name=graph_name, api_version=api_version, template_url=self.get_gremlin_graph_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2043,17 +2148,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -2067,11 +2175,13 @@ def _update_gremlin_graph_throughput_initial( content_type=content_type, json=_json, template_url=self._update_gremlin_graph_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2101,9 +2211,9 @@ 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: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -2131,17 +2241,20 @@ def begin_update_gremlin_graph_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_gremlin_graph_throughput_initial( + raw_result = self._update_gremlin_graph_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2150,20 +2263,27 @@ def begin_update_gremlin_graph_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2183,14 +2303,17 @@ def _migrate_gremlin_graph_to_autoscale_initial( database_name: str, graph_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_gremlin_graph_to_autoscale_request_initial( @@ -2201,11 +2324,13 @@ def _migrate_gremlin_graph_to_autoscale_initial( graph_name=graph_name, api_version=api_version, template_url=self._migrate_gremlin_graph_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2236,7 +2361,7 @@ def begin_migrate_gremlin_graph_to_autoscale( database_name: str, graph_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -2260,36 +2385,46 @@ def begin_migrate_gremlin_graph_to_autoscale( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_gremlin_graph_to_autoscale_initial( + raw_result = self._migrate_gremlin_graph_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, graph_name=graph_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2309,14 +2444,17 @@ def _migrate_gremlin_graph_to_manual_throughput_initial( database_name: str, graph_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_gremlin_graph_to_manual_throughput_request_initial( @@ -2327,11 +2465,13 @@ def _migrate_gremlin_graph_to_manual_throughput_initial( graph_name=graph_name, api_version=api_version, template_url=self._migrate_gremlin_graph_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2362,7 +2502,7 @@ def begin_migrate_gremlin_graph_to_manual_throughput( database_name: str, graph_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -2386,173 +2526,46 @@ def begin_migrate_gremlin_graph_to_manual_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_gremlin_graph_to_manual_throughput_initial( + raw_result = self._migrate_gremlin_graph_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, graph_name=graph_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_gremlin_graph_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - def _retrieve_continuous_backup_information_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> Optional["_models.BackupInformation"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInformation"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') - - request = build_retrieve_continuous_backup_information_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - graph_name=graph_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupInformation', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _retrieve_continuous_backup_information_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation"} # type: ignore - - - @distributed_trace - def begin_retrieve_continuous_backup_information( - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> LROPoller["_models.BackupInformation"]: - """Retrieves continuous backup information for a gremlin graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param graph_name: Cosmos DB graph name. - :type graph_name: str - :param location: The name of the continuous backup restore location. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 BackupInformation or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInformation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._retrieve_continuous_backup_information_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - graph_name=graph_name, - location=location, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BackupInformation', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2563,4 +2576,4 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_retrieve_continuous_backup_information.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation"} # type: ignore + begin_migrate_gremlin_graph_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_locations_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_locations_operations.py index a9cf37fdc93c..191ff556f34d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_locations_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_locations_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -30,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations") path_format_arguments = { @@ -42,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -63,9 +65,12 @@ def build_get_request( location: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}") path_format_arguments = { @@ -76,48 +81,44 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class LocationsOperations(object): - """LocationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class LocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`locations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.LocationListResult"]: + ) -> Iterable[_models.LocationListResult]: """List Cosmos DB locations and their properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -125,13 +126,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LocationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -139,9 +143,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -149,9 +155,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -189,7 +197,7 @@ def get( self, location: str, **kwargs: Any - ) -> "_models.LocationGetResult": + ) -> _models.LocationGetResult: """Get the properties of an existing Cosmos DB location. :param location: Cosmos DB region, with spaces between words and each word capitalized. @@ -199,13 +207,16 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationGetResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LocationGetResult] request = build_get_request( @@ -213,11 +224,13 @@ def get( location=location, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs 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 3525ab579ff9..c7567f97a61f 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_mongo_db_databases_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_mongo_db_databases_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_mongo_db_database_request( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_mongo_db_database_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_update_mongo_db_database_request_initial( account_name: str, database_name: str, *, - json: JSONType = None, + json: Optional[_models.MongoDBDatabaseCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_update_mongo_db_database_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,8 +159,9 @@ def build_delete_mongo_db_database_request_initial( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,13 +174,12 @@ def build_delete_mongo_db_database_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -188,9 +191,12 @@ def build_get_mongo_db_database_throughput_request( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -203,18 +209,16 @@ def build_get_mongo_db_database_throughput_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -225,14 +229,17 @@ def build_update_mongo_db_database_throughput_request_initial( account_name: str, database_name: str, *, - json: JSONType = None, + json: Optional[_models.ThroughputSettingsUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -245,20 +252,18 @@ def build_update_mongo_db_database_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -272,9 +277,12 @@ def build_migrate_mongo_db_database_to_autoscale_request_initial( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long path_format_arguments = { @@ -287,18 +295,16 @@ def build_migrate_mongo_db_database_to_autoscale_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -310,129 +316,34 @@ def build_migrate_mongo_db_database_to_manual_throughput_request_initial( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_mongo_db_container_retrieve_throughput_distribution_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") -def build_mongo_db_container_redistribute_throughput_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, + params=_params, + headers=_headers, **kwargs ) @@ -444,9 +355,12 @@ def build_list_mongo_db_collections_request( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections") # pylint: disable=line-too-long path_format_arguments = { @@ -459,18 +373,16 @@ def build_list_mongo_db_collections_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -483,9 +395,12 @@ def build_get_mongo_db_collection_request( collection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -499,18 +414,16 @@ def build_get_mongo_db_collection_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -522,14 +435,17 @@ def build_create_update_mongo_db_collection_request_initial( database_name: str, collection_name: str, *, - json: JSONType = None, + json: Optional[_models.MongoDBCollectionCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -543,20 +459,18 @@ def build_create_update_mongo_db_collection_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -571,8 +485,9 @@ def build_delete_mongo_db_collection_request_initial( collection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -586,61 +501,12 @@ def build_delete_mongo_db_collection_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - **kwargs - ) - - -def build_list_mongo_db_collection_partition_merge_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, + params=_params, **kwargs ) @@ -653,9 +519,12 @@ def build_get_mongo_db_collection_throughput_request( collection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -669,18 +538,16 @@ def build_get_mongo_db_collection_throughput_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -692,14 +559,17 @@ def build_update_mongo_db_collection_throughput_request_initial( database_name: str, collection_name: str, *, - json: JSONType = None, + json: Optional[_models.ThroughputSettingsUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -713,20 +583,18 @@ def build_update_mongo_db_collection_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -741,9 +609,12 @@ def build_migrate_mongo_db_collection_to_autoscale_request_initial( collection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long path_format_arguments = { @@ -757,18 +628,16 @@ def build_migrate_mongo_db_collection_to_autoscale_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -781,9 +650,12 @@ def build_migrate_mongo_db_collection_to_manual_throughput_request_initial( collection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long path_format_arguments = { @@ -797,482 +669,170 @@ def build_migrate_mongo_db_collection_to_manual_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_mongo_role_definition_request( - mongo_role_definition_id: str, - subscription_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}") # pylint: disable=line-too-long - path_format_arguments = { - "mongoRoleDefinitionId": _SERIALIZER.url("mongo_role_definition_id", mongo_role_definition_id, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -def build_create_update_mongo_role_definition_request_initial( - mongo_role_definition_id: str, +def build_retrieve_continuous_backup_information_request_initial( subscription_id: str, resource_group_name: str, account_name: str, + database_name: str, + collection_name: str, *, - json: JSONType = None, + json: Optional[_models.ContinuousBackupRestoreLocation] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation") # pylint: disable=line-too-long path_format_arguments = { - "mongoRoleDefinitionId": _SERIALIZER.url("mongo_role_definition_id", mongo_role_definition_id, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", + method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) +class MongoDBResourcesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. -def build_delete_mongo_role_definition_request_initial( - mongo_role_definition_id: str, - subscription_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`mongo_db_resources` attribute. + """ - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}") # pylint: disable=line-too-long - path_format_arguments = { - "mongoRoleDefinitionId": _SERIALIZER.url("mongo_role_definition_id", mongo_role_definition_id, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - } + models = _models - _url = _format_url_section(_url, **path_format_arguments) + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + @distributed_trace + def list_mongo_db_databases( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable[_models.MongoDBDatabaseListResult]: + """Lists the MongoDB databases under an existing Azure Cosmos DB database account. - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MongoDBDatabaseListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MongoDBDatabaseListResult] -def build_list_mongo_role_definitions_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_mongo_db_databases_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=self.list_mongo_db_databases.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - } + else: + + request = build_list_mongo_db_databases_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request - _url = _format_url_section(_url, **path_format_arguments) + def extract_data(pipeline_response): + deserialized = self._deserialize("MongoDBDatabaseListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + def get_next(next_link=None): + request = prepare_request(next_link) - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - -def build_get_mongo_user_definition_request( - mongo_user_definition_id: str, - subscription_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}") # pylint: disable=line-too-long - path_format_arguments = { - "mongoUserDefinitionId": _SERIALIZER.url("mongo_user_definition_id", mongo_user_definition_id, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_update_mongo_user_definition_request_initial( - mongo_user_definition_id: str, - subscription_id: str, - resource_group_name: str, - account_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}") # pylint: disable=line-too-long - path_format_arguments = { - "mongoUserDefinitionId": _SERIALIZER.url("mongo_user_definition_id", mongo_user_definition_id, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_mongo_user_definition_request_initial( - mongo_user_definition_id: str, - subscription_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}") # pylint: disable=line-too-long - path_format_arguments = { - "mongoUserDefinitionId": _SERIALIZER.url("mongo_user_definition_id", mongo_user_definition_id, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_mongo_user_definitions_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_retrieve_continuous_backup_information_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class MongoDBResourcesOperations(object): # pylint: disable=too-many-public-methods - """MongoDBResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_mongo_db_databases( - self, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MongoDBDatabaseListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBDatabaseListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_mongo_db_databases_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.list_mongo_db_databases.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_mongo_db_databases_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MongoDBDatabaseListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response + return pipeline_response return ItemPaged( @@ -1287,7 +847,7 @@ def get_mongo_db_database( account_name: str, database_name: str, **kwargs: Any - ) -> "_models.MongoDBDatabaseGetResults": + ) -> _models.MongoDBDatabaseGetResults: """Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. @@ -1302,13 +862,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MongoDBDatabaseGetResults] request = build_get_mongo_db_database_request( @@ -1318,11 +881,13 @@ def get_mongo_db_database( database_name=database_name, api_version=api_version, template_url=self.get_mongo_db_database.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1348,17 +913,20 @@ 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: Any - ) -> Optional["_models.MongoDBDatabaseGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoDBDatabaseGetResults"]] + ) -> Optional[_models.MongoDBDatabaseGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MongoDBDatabaseGetResults]] _json = self._serialize.body(create_update_mongo_db_database_parameters, 'MongoDBDatabaseCreateUpdateParameters') @@ -1371,11 +939,13 @@ def _create_update_mongo_db_database_initial( content_type=content_type, json=_json, template_url=self._create_update_mongo_db_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1404,9 +974,9 @@ 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: Any - ) -> LROPoller["_models.MongoDBDatabaseGetResults"]: + ) -> 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. @@ -1432,17 +1002,20 @@ def begin_create_update_mongo_db_database( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MongoDBDatabaseGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_mongo_db_database_initial( + raw_result = self._create_update_mongo_db_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1450,20 +1023,27 @@ def begin_create_update_mongo_db_database( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MongoDBDatabaseGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1483,13 +1063,16 @@ def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-return-st database_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_mongo_db_database_request_initial( @@ -1499,11 +1082,13 @@ def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-return-st database_name=database_name, api_version=api_version, template_url=self._delete_mongo_db_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1548,21 +1133,26 @@ def begin_delete_mongo_db_database( # pylint: disable=inconsistent-return-state :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_mongo_db_database_initial( + raw_result = self._delete_mongo_db_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1572,8 +1162,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1593,7 +1189,7 @@ def get_mongo_db_database_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> "_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. @@ -1608,13 +1204,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_mongo_db_database_throughput_request( @@ -1624,11 +1223,13 @@ def get_mongo_db_database_throughput( database_name=database_name, api_version=api_version, template_url=self.get_mongo_db_database_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1654,17 +1255,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -1677,11 +1281,13 @@ def _update_mongo_db_database_throughput_initial( content_type=content_type, json=_json, template_url=self._update_mongo_db_database_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1710,9 +1316,9 @@ 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: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -1738,17 +1344,20 @@ def begin_update_mongo_db_database_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_mongo_db_database_throughput_initial( + raw_result = self._update_mongo_db_database_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1756,20 +1365,27 @@ def begin_update_mongo_db_database_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1788,14 +1404,17 @@ def _migrate_mongo_db_database_to_autoscale_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_mongo_db_database_to_autoscale_request_initial( @@ -1805,11 +1424,13 @@ def _migrate_mongo_db_database_to_autoscale_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_mongo_db_database_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1839,7 +1460,7 @@ def begin_migrate_mongo_db_database_to_autoscale( account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -1861,35 +1482,45 @@ def begin_migrate_mongo_db_database_to_autoscale( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_mongo_db_database_to_autoscale_initial( + raw_result = self._migrate_mongo_db_database_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1908,14 +1539,17 @@ def _migrate_mongo_db_database_to_manual_throughput_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_mongo_db_database_to_manual_throughput_request_initial( @@ -1925,11 +1559,13 @@ def _migrate_mongo_db_database_to_manual_throughput_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_mongo_db_database_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1959,7 +1595,7 @@ def begin_migrate_mongo_db_database_to_manual_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -1981,314 +1617,45 @@ def begin_migrate_mongo_db_database_to_manual_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_mongo_db_database_to_manual_throughput_initial( + raw_result = self._migrate_mongo_db_database_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_mongo_db_database_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - def _mongo_db_container_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: "_models.RetrieveThroughputParameters", - **kwargs: Any - ) -> Optional["_models.PhysicalPartitionThroughputInfoResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionThroughputInfoResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(retrieve_throughput_parameters, 'RetrieveThroughputParameters') - - request = build_mongo_db_container_retrieve_throughput_distribution_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._mongo_db_container_retrieve_throughput_distribution_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_container_retrieve_throughput_distribution_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - - @distributed_trace - def begin_mongo_db_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: "_models.RetrieveThroughputParameters", - **kwargs: Any - ) -> LROPoller["_models.PhysicalPartitionThroughputInfoResult"]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param collection_name: Cosmos DB collection name. - :type collection_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB container. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionThroughputInfoResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._mongo_db_container_retrieve_throughput_distribution_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_mongo_db_container_retrieve_throughput_distribution.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - def _mongo_db_container_redistribute_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: "_models.RedistributeThroughputParameters", - **kwargs: Any - ) -> Optional["_models.PhysicalPartitionThroughputInfoResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionThroughputInfoResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(redistribute_throughput_parameters, 'RedistributeThroughputParameters') - - request = build_mongo_db_container_redistribute_throughput_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._mongo_db_container_redistribute_throughput_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_container_redistribute_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - - @distributed_trace - def begin_mongo_db_container_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: "_models.RedistributeThroughputParameters", - **kwargs: Any - ) -> LROPoller["_models.PhysicalPartitionThroughputInfoResult"]: - """Redistribute throughput for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param collection_name: Cosmos DB collection name. - :type collection_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB container. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionThroughputInfoResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._mongo_db_container_redistribute_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2299,7 +1666,7 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_mongo_db_container_redistribute_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput"} # type: ignore + begin_migrate_mongo_db_database_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace def list_mongo_db_collections( @@ -2308,7 +1675,7 @@ def list_mongo_db_collections( account_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.MongoDBCollectionListResult"]: + ) -> 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. @@ -2323,13 +1690,16 @@ def list_mongo_db_collections( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2340,9 +1710,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=self.list_mongo_db_collections.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2353,9 +1725,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -2396,7 +1770,7 @@ def get_mongo_db_collection( database_name: str, collection_name: str, **kwargs: Any - ) -> "_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. @@ -2412,13 +1786,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MongoDBCollectionGetResults] request = build_get_mongo_db_collection_request( @@ -2429,11 +1806,13 @@ def get_mongo_db_collection( collection_name=collection_name, api_version=api_version, template_url=self.get_mongo_db_collection.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2460,17 +1839,20 @@ 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: Any - ) -> Optional["_models.MongoDBCollectionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoDBCollectionGetResults"]] + ) -> Optional[_models.MongoDBCollectionGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MongoDBCollectionGetResults]] _json = self._serialize.body(create_update_mongo_db_collection_parameters, 'MongoDBCollectionCreateUpdateParameters') @@ -2484,11 +1866,13 @@ def _create_update_mongo_db_collection_initial( content_type=content_type, json=_json, template_url=self._create_update_mongo_db_collection_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2518,9 +1902,9 @@ 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: Any - ) -> LROPoller["_models.MongoDBCollectionGetResults"]: + ) -> 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. @@ -2548,17 +1932,20 @@ def begin_create_update_mongo_db_collection( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MongoDBCollectionGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoDBCollectionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_mongo_db_collection_initial( + raw_result = self._create_update_mongo_db_collection_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2567,20 +1954,27 @@ def begin_create_update_mongo_db_collection( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MongoDBCollectionGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2601,13 +1995,16 @@ def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-return- collection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_mongo_db_collection_request_initial( @@ -2618,11 +2015,13 @@ def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-return- collection_name=collection_name, api_version=api_version, template_url=self._delete_mongo_db_collection_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2670,22 +2069,27 @@ def begin_delete_mongo_db_collection( # pylint: disable=inconsistent-return-sta :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_mongo_db_collection_initial( + raw_result = self._delete_mongo_db_collection_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, collection_name=collection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2695,8 +2099,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2709,202 +2119,69 @@ def get_long_running_output(pipeline_response): begin_delete_mongo_db_collection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore - def _list_mongo_db_collection_partition_merge_initial( + @distributed_trace + def get_mongo_db_collection_throughput( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - merge_parameters: "_models.MergeParameters", **kwargs: Any - ) -> Optional["_models.PhysicalPartitionStorageInfoCollection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionStorageInfoCollection"]] + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ThroughputSettingsGetResults, or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :raises: ~azure.core.exceptions.HttpResponseError + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(merge_parameters, 'MergeParameters') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] - request = build_list_mongo_db_collection_partition_merge_request_initial( + + request = build_get_mongo_db_collection_throughput_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, collection_name=collection_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._list_mongo_db_collection_partition_merge_initial.metadata['url'], + template_url=self.get_mongo_db_collection_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _list_mongo_db_collection_partition_merge_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge"} # type: ignore - - - @distributed_trace - def begin_list_mongo_db_collection_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: "_models.MergeParameters", - **kwargs: Any - ) -> LROPoller["_models.PhysicalPartitionStorageInfoCollection"]: - """Merges the partitions of a MongoDB Collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param collection_name: Cosmos DB collection name. - :type collection_name: str - :param merge_parameters: The parameters for the merge operation. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 PhysicalPartitionStorageInfoCollection or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionStorageInfoCollection"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._list_mongo_db_collection_partition_merge_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - merge_parameters=merge_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_list_mongo_db_collection_partition_merge.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge"} # type: ignore - - @distributed_trace - def get_mongo_db_collection_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": - """Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database - account with the provided name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param collection_name: Cosmos DB collection name. - :type collection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ThroughputSettingsGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_mongo_db_collection_throughput_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - api_version=api_version, - template_url=self.get_mongo_db_collection_throughput.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2920,17 +2197,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -2944,11 +2224,13 @@ def _update_mongo_db_collection_throughput_initial( content_type=content_type, json=_json, template_url=self._update_mongo_db_collection_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2978,9 +2260,9 @@ 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: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -3008,17 +2290,20 @@ def begin_update_mongo_db_collection_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_mongo_db_collection_throughput_initial( + raw_result = self._update_mongo_db_collection_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3027,20 +2312,27 @@ def begin_update_mongo_db_collection_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3060,14 +2352,17 @@ def _migrate_mongo_db_collection_to_autoscale_initial( database_name: str, collection_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_mongo_db_collection_to_autoscale_request_initial( @@ -3078,11 +2373,13 @@ def _migrate_mongo_db_collection_to_autoscale_initial( collection_name=collection_name, api_version=api_version, template_url=self._migrate_mongo_db_collection_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3113,7 +2410,7 @@ def begin_migrate_mongo_db_collection_to_autoscale( database_name: str, collection_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -3137,36 +2434,46 @@ def begin_migrate_mongo_db_collection_to_autoscale( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_mongo_db_collection_to_autoscale_initial( + raw_result = self._migrate_mongo_db_collection_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, collection_name=collection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3186,14 +2493,17 @@ def _migrate_mongo_db_collection_to_manual_throughput_initial( database_name: str, collection_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_mongo_db_collection_to_manual_throughput_request_initial( @@ -3204,11 +2514,13 @@ def _migrate_mongo_db_collection_to_manual_throughput_initial( collection_name=collection_name, api_version=api_version, template_url=self._migrate_mongo_db_collection_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3239,7 +2551,7 @@ def begin_migrate_mongo_db_collection_to_manual_throughput( database_name: str, collection_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -3263,36 +2575,46 @@ def begin_migrate_mongo_db_collection_to_manual_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_mongo_db_collection_to_manual_throughput_initial( + raw_result = self._migrate_mongo_db_collection_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, collection_name=collection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3305,102 +2627,46 @@ def get_long_running_output(pipeline_response): begin_migrate_mongo_db_collection_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - @distributed_trace - def get_mongo_role_definition( + def _retrieve_continuous_backup_information_initial( self, - mongo_role_definition_id: str, resource_group_name: str, account_name: str, + database_name: str, + collection_name: str, + location: _models.ContinuousBackupRestoreLocation, **kwargs: Any - ) -> "_models.MongoRoleDefinitionGetResults": - """Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given - Id. - - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. - :type mongo_role_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MongoRoleDefinitionGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoRoleDefinitionGetResults"] + ) -> Optional[_models.BackupInformation]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_mongo_role_definition_request( - mongo_role_definition_id=mongo_role_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.get_mongo_role_definition.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MongoRoleDefinitionGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_mongo_role_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + error_map.update(kwargs.pop('error_map', {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - def _create_update_mongo_role_definition_initial( - self, - mongo_role_definition_id: str, - resource_group_name: str, - account_name: str, - create_update_mongo_role_definition_parameters: "_models.MongoRoleDefinitionCreateUpdateParameters", - **kwargs: Any - ) -> Optional["_models.MongoRoleDefinitionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoRoleDefinitionGetResults"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.BackupInformation]] - _json = self._serialize.body(create_update_mongo_role_definition_parameters, 'MongoRoleDefinitionCreateUpdateParameters') + _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') - request = build_create_update_mongo_role_definition_request_initial( - mongo_role_definition_id=mongo_role_definition_id, + request = build_retrieve_continuous_backup_information_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, + collection_name=collection_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_update_mongo_role_definition_initial.metadata['url'], + template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3413,37 +2679,38 @@ def _create_update_mongo_role_definition_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MongoRoleDefinitionGetResults', pipeline_response) + deserialized = self._deserialize('BackupInformation', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_update_mongo_role_definition_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation"} # type: ignore @distributed_trace - def begin_create_update_mongo_role_definition( + def begin_retrieve_continuous_backup_information( self, - mongo_role_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: "_models.MongoRoleDefinitionCreateUpdateParameters", + database_name: str, + collection_name: str, + location: _models.ContinuousBackupRestoreLocation, **kwargs: Any - ) -> LROPoller["_models.MongoRoleDefinitionGetResults"]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. - :type mongo_role_definition_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param account_name: Cosmos DB database account name. :type account_name: str - :param create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. - :type create_update_mongo_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters + :param database_name: Cosmos DB database name. + :type database_name: str + :param collection_name: Cosmos DB collection name. + :type collection_name: str + :param location: The name of the continuous backup restore location. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -3452,762 +2719,54 @@ def begin_create_update_mongo_role_definition( :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 MongoRoleDefinitionGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + :return: An instance of LROPoller that returns either BackupInformation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupInformation] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoRoleDefinitionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_mongo_role_definition_initial( - mongo_role_definition_id=mongo_role_definition_id, + raw_result = self._retrieve_continuous_backup_information_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, - create_update_mongo_role_definition_parameters=create_update_mongo_role_definition_parameters, + database_name=database_name, + collection_name=collection_name, + location=location, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MongoRoleDefinitionGetResults', pipeline_response) + deserialized = self._deserialize('BackupInformation', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_mongo_role_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore - - def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent-return-statements - self, - mongo_role_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_delete_mongo_role_definition_request_initial( - mongo_role_definition_id=mongo_role_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self._delete_mongo_role_definition_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_mongo_role_definition_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore - - - @distributed_trace - def begin_delete_mongo_role_definition( # pylint: disable=inconsistent-return-statements - self, - mongo_role_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Mongo Role Definition. - - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. - :type mongo_role_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_mongo_role_definition_initial( - mongo_role_definition_id=mongo_role_definition_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_mongo_role_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore - - @distributed_trace - def list_mongo_role_definitions( - self, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> Iterable["_models.MongoRoleDefinitionListResult"]: - """Retrieves the list of all Azure Cosmos DB Mongo Role Definitions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MongoRoleDefinitionListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoRoleDefinitionListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_mongo_role_definitions_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.list_mongo_role_definitions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_mongo_role_definitions_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MongoRoleDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_mongo_role_definitions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions"} # type: ignore - - @distributed_trace - def get_mongo_user_definition( - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> "_models.MongoUserDefinitionGetResults": - """Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given - Id. - - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. - :type mongo_user_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MongoUserDefinitionGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoUserDefinitionGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_mongo_user_definition_request( - mongo_user_definition_id=mongo_user_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.get_mongo_user_definition.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MongoUserDefinitionGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_mongo_user_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - - def _create_update_mongo_user_definition_initial( - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - create_update_mongo_user_definition_parameters: "_models.MongoUserDefinitionCreateUpdateParameters", - **kwargs: Any - ) -> Optional["_models.MongoUserDefinitionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MongoUserDefinitionGetResults"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(create_update_mongo_user_definition_parameters, 'MongoUserDefinitionCreateUpdateParameters') - - request = build_create_update_mongo_user_definition_request_initial( - mongo_user_definition_id=mongo_user_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_update_mongo_user_definition_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MongoUserDefinitionGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_mongo_user_definition_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - - @distributed_trace - def begin_create_update_mongo_user_definition( - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - create_update_mongo_user_definition_parameters: "_models.MongoUserDefinitionCreateUpdateParameters", - **kwargs: Any - ) -> LROPoller["_models.MongoUserDefinitionGetResults"]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. - - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. - :type mongo_user_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. - :type create_update_mongo_user_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 MongoUserDefinitionGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoUserDefinitionGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_update_mongo_user_definition_initial( - mongo_user_definition_id=mongo_user_definition_id, - resource_group_name=resource_group_name, - account_name=account_name, - create_update_mongo_user_definition_parameters=create_update_mongo_user_definition_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MongoUserDefinitionGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_mongo_user_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent-return-statements - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_delete_mongo_user_definition_request_initial( - mongo_user_definition_id=mongo_user_definition_id, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self._delete_mongo_user_definition_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_mongo_user_definition_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - - @distributed_trace - def begin_delete_mongo_user_definition( # pylint: disable=inconsistent-return-statements - self, - mongo_user_definition_id: str, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Mongo User Definition. - - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. - :type mongo_user_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_mongo_user_definition_initial( - mongo_user_definition_id=mongo_user_definition_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_mongo_user_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore - - @distributed_trace - def list_mongo_user_definitions( - self, - resource_group_name: str, - account_name: str, - **kwargs: Any - ) -> Iterable["_models.MongoUserDefinitionListResult"]: - """Retrieves the list of all Azure Cosmos DB Mongo User Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MongoUserDefinitionListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoUserDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.MongoUserDefinitionListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_mongo_user_definitions_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=self.list_mongo_user_definitions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, - request = build_list_mongo_user_definitions_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MongoUserDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_mongo_user_definitions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions"} # type: ignore - - def _retrieve_continuous_backup_information_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> Optional["_models.BackupInformation"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInformation"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') - - request = build_retrieve_continuous_backup_information_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupInformation', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _retrieve_continuous_backup_information_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation"} # type: ignore - - - @distributed_trace - def begin_retrieve_continuous_backup_information( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> LROPoller["_models.BackupInformation"]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param collection_name: Cosmos DB collection name. - :type collection_name: str - :param location: The name of the continuous backup restore location. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 BackupInformation or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInformation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._retrieve_continuous_backup_information_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - location=location, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BackupInformation', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_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 a4e7d76789a1..5fcebcdcac7a 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_by_database_account_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_by_database_account_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( account_name: str, notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], *, - json: JSONType = None, + json: Optional[_models.NotebookWorkspaceCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_list_connection_info_request( notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_list_connection_info_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -232,9 +237,12 @@ def build_regenerate_auth_token_request_initial( notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken") # pylint: disable=line-too-long path_format_arguments = { @@ -247,18 +255,16 @@ def build_regenerate_auth_token_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -270,9 +276,12 @@ def build_start_request_initial( notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -285,42 +294,38 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class NotebookWorkspacesOperations(object): - """NotebookWorkspacesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class NotebookWorkspacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`notebook_workspaces` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_database_account( @@ -328,7 +333,7 @@ def list_by_database_account( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.NotebookWorkspaceListResult"]: + ) -> 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. @@ -341,13 +346,16 @@ def list_by_database_account( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.NotebookWorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_by_database_account.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -412,7 +424,7 @@ def get( account_name: str, notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any - ) -> "_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. @@ -426,13 +438,16 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotebookWorkspace] request = build_get_request( @@ -442,11 +457,13 @@ def get( notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, account_name: str, notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], - notebook_create_update_parameters: "_models.NotebookWorkspaceCreateUpdateParameters", + notebook_create_update_parameters: _models.NotebookWorkspaceCreateUpdateParameters, **kwargs: Any - ) -> "_models.NotebookWorkspace": - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] + ) -> _models.NotebookWorkspace: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotebookWorkspace] _json = self._serialize.body(notebook_create_update_parameters, 'NotebookWorkspaceCreateUpdateParameters') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -527,9 +549,9 @@ def begin_create_or_update( resource_group_name: str, account_name: str, notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], - notebook_create_update_parameters: "_models.NotebookWorkspaceCreateUpdateParameters", + notebook_create_update_parameters: _models.NotebookWorkspaceCreateUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.NotebookWorkspace"]: + ) -> 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. @@ -555,17 +577,20 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotebookWorkspace] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspace"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, @@ -573,20 +598,27 @@ def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('NotebookWorkspace', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -606,13 +638,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -622,11 +657,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -671,21 +708,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -695,8 +737,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -716,7 +764,7 @@ def list_connection_info( account_name: str, notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any - ) -> "_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. @@ -730,13 +778,16 @@ def list_connection_info( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookWorkspaceConnectionInfoResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotebookWorkspaceConnectionInfoResult] request = build_list_connection_info_request( @@ -746,11 +797,13 @@ def list_connection_info( notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self.list_connection_info.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -779,13 +832,16 @@ def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return-state notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_regenerate_auth_token_request_initial( @@ -795,11 +851,13 @@ def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return-state notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self._regenerate_auth_token_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -844,21 +902,26 @@ def begin_regenerate_auth_token( # pylint: disable=inconsistent-return-statemen :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._regenerate_auth_token_initial( + raw_result = self._regenerate_auth_token_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -868,8 +931,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -889,13 +958,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements notebook_workspace_name: Union[str, "_models.NotebookWorkspaceName"], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -905,11 +977,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements notebook_workspace_name=notebook_workspace_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -954,21 +1028,26 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -978,8 +1057,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_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 ff8038534f15..36809771528d 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.DocumentDB/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> 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 @@ -85,31 +85,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 a7ae86697b34..c3e0a41a00da 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -37,9 +38,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -54,43 +58,39 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PartitionKeyRangeIdOperations(object): - """PartitionKeyRangeIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PartitionKeyRangeIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`partition_key_range_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -102,7 +102,7 @@ def list_metrics( partition_key_range_id: str, filter: str, **kwargs: Any - ) -> Iterable["_models.PartitionMetricListResult"]: + ) -> 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. @@ -125,13 +125,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -145,9 +148,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -161,9 +166,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 25808d9c5b04..9425be61aaef 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -38,9 +39,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -56,43 +60,39 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PartitionKeyRangeIdRegionOperations(object): - """PartitionKeyRangeIdRegionOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PartitionKeyRangeIdRegionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`partition_key_range_id_region` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -105,7 +105,7 @@ def list_metrics( partition_key_range_id: str, filter: str, **kwargs: Any - ) -> Iterable["_models.PartitionMetricListResult"]: + ) -> Iterable[_models.PartitionMetricListResult]: """Retrieves the metrics determined by the given filter for the given partition key range id and region. @@ -131,13 +131,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +155,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +174,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 c4909dac882a..b4f3dc8abf56 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -34,9 +35,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -48,43 +52,39 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PercentileOperations(object): - """PercentileOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PercentileOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`percentile` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -93,7 +93,7 @@ def list_metrics( account_name: str, filter: str, **kwargs: Any - ) -> Iterable["_models.PercentileMetricListResult"]: + ) -> 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. @@ -111,13 +111,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -128,9 +131,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -141,9 +146,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 e37f1a7c5b59..741cc1a7e51c 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -36,9 +37,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -52,43 +56,39 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PercentileSourceTargetOperations(object): - """PercentileSourceTargetOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PercentileSourceTargetOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`percentile_source_target` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -99,7 +99,7 @@ def list_metrics( target_region: str, filter: str, **kwargs: Any - ) -> Iterable["_models.PercentileMetricListResult"]: + ) -> 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. @@ -123,13 +123,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -142,9 +145,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -157,9 +162,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 d23d3ff6ceee..59a87c166684 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -35,9 +36,12 @@ def build_list_metrics_request( filter: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics") # pylint: disable=line-too-long path_format_arguments = { @@ -50,43 +54,39 @@ def build_list_metrics_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PercentileTargetOperations(object): - """PercentileTargetOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PercentileTargetOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`percentile_target` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_metrics( @@ -96,7 +96,7 @@ def list_metrics( target_region: str, filter: str, **kwargs: Any - ) -> Iterable["_models.PercentileMetricListResult"]: + ) -> 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. @@ -117,13 +117,16 @@ def list_metrics( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetricListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -135,9 +138,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_metrics.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -149,9 +154,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 f34d74af7725..e86c28368590 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_by_database_account_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_by_database_account_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( account_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_database_account( @@ -214,7 +216,7 @@ def list_by_database_account( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + ) -> 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. @@ -228,13 +230,16 @@ def list_by_database_account( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_by_database_account.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( account_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -312,13 +321,16 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -328,11 +340,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -358,17 +372,20 @@ def _create_or_update_initial( resource_group_name: str, account_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -381,11 +398,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -414,9 +433,9 @@ def begin_create_or_update( resource_group_name: str, account_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> LROPoller["_models.PrivateEndpointConnection"]: + ) -> 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. @@ -440,17 +459,20 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -458,20 +480,27 @@ def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_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) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -491,13 +520,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -507,11 +539,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -556,21 +590,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -580,8 +619,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_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 2b9a71f34426..9eedc37be766 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 @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -32,9 +33,12 @@ def build_list_by_database_account_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -46,18 +50,16 @@ def build_list_by_database_account_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -69,9 +71,12 @@ def build_get_request( group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}") # pylint: disable=line-too-long path_format_arguments = { @@ -84,42 +89,38 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_database_account( @@ -127,7 +128,7 @@ def list_by_database_account( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateLinkResourceListResult"]: + ) -> 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. @@ -140,13 +141,16 @@ def list_by_database_account( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -156,9 +160,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_by_database_account.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -168,9 +174,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +218,7 @@ def get( account_name: str, group_name: str, **kwargs: Any - ) -> "_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. @@ -224,13 +232,16 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] request = build_get_request( @@ -240,11 +251,13 @@ def get( group_name=group_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_database_accounts_operations.py index 063c6dcb9611..d4ad9784d2ee 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_database_accounts_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_location_request( location: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts") # pylint: disable=line-too-long path_format_arguments = { @@ -44,18 +48,16 @@ def build_list_by_location_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +66,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts") # pylint: disable=line-too-long path_format_arguments = { @@ -76,18 +81,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -98,9 +101,12 @@ def build_get_by_location_request( instance_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}") # pylint: disable=line-too-long path_format_arguments = { @@ -112,49 +118,45 @@ def build_get_by_location_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class RestorableDatabaseAccountsOperations(object): - """RestorableDatabaseAccountsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RestorableDatabaseAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_database_accounts` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_location( self, location: str, **kwargs: Any - ) -> Iterable["_models.RestorableDatabaseAccountsListResult"]: + ) -> Iterable[_models.RestorableDatabaseAccountsListResult]: """Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. @@ -168,13 +170,16 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableDatabaseAccountsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDatabaseAccountsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -183,9 +188,11 @@ def prepare_request(next_link=None): location=location, api_version=api_version, template_url=self.list_by_location.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -194,9 +201,11 @@ def prepare_request(next_link=None): location=location, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -233,7 +242,7 @@ def get_next(next_link=None): def list( self, **kwargs: Any - ) -> Iterable["_models.RestorableDatabaseAccountsListResult"]: + ) -> Iterable[_models.RestorableDatabaseAccountsListResult]: """Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. @@ -244,13 +253,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableDatabaseAccountsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDatabaseAccountsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -258,9 +270,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -268,9 +282,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -309,7 +325,7 @@ def get_by_location( location: str, instance_id: str, **kwargs: Any - ) -> "_models.RestorableDatabaseAccountGetResult": + ) -> _models.RestorableDatabaseAccountGetResult: """Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. @@ -322,13 +338,16 @@ def get_by_location( :rtype: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDatabaseAccountGetResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableDatabaseAccountGetResult] request = build_get_by_location_request( @@ -337,11 +356,13 @@ def get_by_location( instance_id=instance_id, api_version=api_version, template_url=self.get_by_location.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_databases_operations.py deleted file mode 100644 index 99bf283f3ba3..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_databases_operations.py +++ /dev/null @@ -1,170 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - location: str, - instance_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinDatabases") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str'), - "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class RestorableGremlinDatabasesOperations(object): - """RestorableGremlinDatabasesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - **kwargs: Any - ) -> Iterable["_models.RestorableGremlinDatabasesListResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin databases under - the restorable account. This helps in scenario where database was accidentally deleted to get - the deletion time. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableGremlinDatabasesListResult or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableGremlinDatabasesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableGremlinDatabasesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinDatabases"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_graphs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_graphs_operations.py deleted file mode 100644 index 1165f5fa277a..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_graphs_operations.py +++ /dev/null @@ -1,195 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - location: str, - instance_id: str, - *, - restorable_gremlin_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str'), - "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if restorable_gremlin_database_rid is not None: - _query_parameters['restorableGremlinDatabaseRid'] = _SERIALIZER.query("restorable_gremlin_database_rid", restorable_gremlin_database_rid, 'str') - if start_time is not None: - _query_parameters['startTime'] = _SERIALIZER.query("start_time", start_time, 'str') - if end_time is not None: - _query_parameters['endTime'] = _SERIALIZER.query("end_time", end_time, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class RestorableGremlinGraphsOperations(object): - """RestorableGremlinGraphsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - restorable_gremlin_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RestorableGremlinGraphsListResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs under a - specific database. This helps in scenario where container was accidentally deleted. This API - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :param restorable_gremlin_database_rid: The resource ID of the Gremlin database. Default value - is None. - :type restorable_gremlin_database_rid: str - :param start_time: Restorable Gremlin graphs event feed start time. Default value is None. - :type start_time: str - :param end_time: Restorable Gremlin graphs event feed end time. Default value is None. - :type end_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableGremlinGraphsListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinGraphsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableGremlinGraphsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restorable_gremlin_database_rid=restorable_gremlin_database_rid, - start_time=start_time, - end_time=end_time, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restorable_gremlin_database_rid=restorable_gremlin_database_rid, - start_time=start_time, - end_time=end_time, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableGremlinGraphsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_resources_operations.py deleted file mode 100644 index 1dbd4b445206..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_resources_operations.py +++ /dev/null @@ -1,189 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - location: str, - instance_id: str, - *, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinResources") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str'), - "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if restore_location is not None: - _query_parameters['restoreLocation'] = _SERIALIZER.query("restore_location", restore_location, 'str') - if restore_timestamp_in_utc is not None: - _query_parameters['restoreTimestampInUtc'] = _SERIALIZER.query("restore_timestamp_in_utc", restore_timestamp_in_utc, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class RestorableGremlinResourcesOperations(object): - """RestorableGremlinResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RestorableGremlinResourcesListResult"]: - """Return a list of gremlin database and graphs combo that exist on the account at the given - timestamp and location. This helps in scenarios to validate what resources exist at given - timestamp and location. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :param restore_location: The location where the restorable resources are located. Default value - is None. - :type restore_location: str - :param restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :type restore_timestamp_in_utc: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableGremlinResourcesListResult or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinResourcesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableGremlinResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableGremlinResourcesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinResources"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_collections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_collections_operations.py index 7c065de5db35..395170347229 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_collections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_collections_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -32,13 +33,14 @@ def build_list_request( instance_id: str, *, restorable_mongodb_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections") # pylint: disable=line-too-long path_format_arguments = { @@ -50,48 +52,40 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if restorable_mongodb_database_rid is not None: - _query_parameters['restorableMongodbDatabaseRid'] = _SERIALIZER.query("restorable_mongodb_database_rid", restorable_mongodb_database_rid, 'str') - if start_time is not None: - _query_parameters['startTime'] = _SERIALIZER.query("start_time", start_time, 'str') - if end_time is not None: - _query_parameters['endTime'] = _SERIALIZER.query("end_time", end_time, 'str') + _params['restorableMongodbDatabaseRid'] = _SERIALIZER.query("restorable_mongodb_database_rid", restorable_mongodb_database_rid, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class RestorableMongodbCollectionsOperations(object): - """RestorableMongodbCollectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RestorableMongodbCollectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_collections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -99,10 +93,8 @@ def list( location: str, instance_id: str, restorable_mongodb_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RestorableMongodbCollectionsListResult"]: + ) -> Iterable[_models.RestorableMongodbCollectionsListResult]: """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. @@ -114,10 +106,6 @@ def list( :param restorable_mongodb_database_rid: The resource ID of the MongoDB database. Default value is None. :type restorable_mongodb_database_rid: str - :param start_time: Restorable MongoDB collections event feed start time. Default value is None. - :type start_time: str - :param end_time: Restorable MongoDB collections event feed end time. Default value is None. - :type end_time: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RestorableMongodbCollectionsListResult or the result of cls(response) @@ -125,13 +113,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableMongodbCollectionsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableMongodbCollectionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -141,12 +132,12 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, restorable_mongodb_database_rid=restorable_mongodb_database_rid, - start_time=start_time, - end_time=end_time, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -156,12 +147,12 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, restorable_mongodb_database_rid=restorable_mongodb_database_rid, - start_time=start_time, - end_time=end_time, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_databases_operations.py index 6862f5b0c85e..8c23d1320ce5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_databases_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -32,9 +33,12 @@ def build_list_request( instance_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases") # pylint: disable=line-too-long path_format_arguments = { @@ -46,42 +50,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class RestorableMongodbDatabasesOperations(object): - """RestorableMongodbDatabasesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RestorableMongodbDatabasesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_databases` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -89,7 +89,7 @@ def list( location: str, instance_id: str, **kwargs: Any - ) -> Iterable["_models.RestorableMongodbDatabasesListResult"]: + ) -> Iterable[_models.RestorableMongodbDatabasesListResult]: """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires @@ -106,13 +106,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbDatabasesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableMongodbDatabasesListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableMongodbDatabasesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -122,9 +125,11 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -134,9 +139,11 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_resources_operations.py index 82e6b16d497f..f7981c19e0f6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_resources_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -35,9 +36,12 @@ def build_list_request( restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources") # pylint: disable=line-too-long path_format_arguments = { @@ -49,46 +53,42 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if restore_location is not None: - _query_parameters['restoreLocation'] = _SERIALIZER.query("restore_location", restore_location, 'str') + _params['restoreLocation'] = _SERIALIZER.query("restore_location", restore_location, 'str') if restore_timestamp_in_utc is not None: - _query_parameters['restoreTimestampInUtc'] = _SERIALIZER.query("restore_timestamp_in_utc", restore_timestamp_in_utc, 'str') + _params['restoreTimestampInUtc'] = _SERIALIZER.query("restore_timestamp_in_utc", restore_timestamp_in_utc, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class RestorableMongodbResourcesOperations(object): - """RestorableMongodbResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RestorableMongodbResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -98,7 +98,7 @@ def list( restore_location: Optional[str] = None, restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RestorableMongodbResourcesListResult"]: + ) -> Iterable[_models.RestorableMongodbResourcesListResult]: """Return a list of database and collection combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires @@ -121,13 +121,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbResourcesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableMongodbResourcesListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableMongodbResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -139,9 +142,11 @@ def prepare_request(next_link=None): restore_location=restore_location, restore_timestamp_in_utc=restore_timestamp_in_utc, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -153,9 +158,11 @@ def prepare_request(next_link=None): restore_location=restore_location, restore_timestamp_in_utc=restore_timestamp_in_utc, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_containers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_containers_operations.py index f6ca9d5fe27a..6d38a958cb08 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_containers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_containers_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -36,9 +37,12 @@ def build_list_request( end_time: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers") # pylint: disable=line-too-long path_format_arguments = { @@ -50,48 +54,44 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if restorable_sql_database_rid is not None: - _query_parameters['restorableSqlDatabaseRid'] = _SERIALIZER.query("restorable_sql_database_rid", restorable_sql_database_rid, 'str') + _params['restorableSqlDatabaseRid'] = _SERIALIZER.query("restorable_sql_database_rid", restorable_sql_database_rid, 'str') if start_time is not None: - _query_parameters['startTime'] = _SERIALIZER.query("start_time", start_time, 'str') + _params['startTime'] = _SERIALIZER.query("start_time", start_time, 'str') if end_time is not None: - _query_parameters['endTime'] = _SERIALIZER.query("end_time", end_time, 'str') + _params['endTime'] = _SERIALIZER.query("end_time", end_time, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class RestorableSqlContainersOperations(object): - """RestorableSqlContainersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RestorableSqlContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_sql_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -102,7 +102,7 @@ def list( start_time: Optional[str] = None, end_time: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RestorableSqlContainersListResult"]: + ) -> Iterable[_models.RestorableSqlContainersListResult]: """Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. @@ -113,9 +113,11 @@ def list( :type instance_id: str :param restorable_sql_database_rid: The resource ID of the SQL database. Default value is None. :type restorable_sql_database_rid: str - :param start_time: Restorable Sql containers event feed start time. Default value is None. + :param start_time: The snapshot create timestamp after which snapshots need to be listed. + Default value is None. :type start_time: str - :param end_time: Restorable Sql containers event feed end time. Default value is None. + :param end_time: The snapshot create timestamp before which snapshots need to be listed. + Default value is None. :type end_time: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RestorableSqlContainersListResult or the result of @@ -124,13 +126,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlContainersListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableSqlContainersListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableSqlContainersListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -143,9 +148,11 @@ def prepare_request(next_link=None): start_time=start_time, end_time=end_time, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -158,9 +165,11 @@ def prepare_request(next_link=None): start_time=start_time, end_time=end_time, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_databases_operations.py index 3a4a151a1628..4817dfba9c25 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_databases_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -32,9 +33,12 @@ def build_list_request( instance_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases") # pylint: disable=line-too-long path_format_arguments = { @@ -46,42 +50,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class RestorableSqlDatabasesOperations(object): - """RestorableSqlDatabasesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RestorableSqlDatabasesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_sql_databases` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -89,7 +89,7 @@ def list( location: str, instance_id: str, **kwargs: Any - ) -> Iterable["_models.RestorableSqlDatabasesListResult"]: + ) -> Iterable[_models.RestorableSqlDatabasesListResult]: """Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires @@ -106,13 +106,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlDatabasesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableSqlDatabasesListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableSqlDatabasesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -122,9 +125,11 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -134,9 +139,11 @@ def prepare_request(next_link=None): instance_id=instance_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_resources_operations.py index 1e53612eb020..0706f633d378 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_resources_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -35,9 +36,12 @@ def build_list_request( restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources") # pylint: disable=line-too-long path_format_arguments = { @@ -49,46 +53,42 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if restore_location is not None: - _query_parameters['restoreLocation'] = _SERIALIZER.query("restore_location", restore_location, 'str') + _params['restoreLocation'] = _SERIALIZER.query("restore_location", restore_location, 'str') if restore_timestamp_in_utc is not None: - _query_parameters['restoreTimestampInUtc'] = _SERIALIZER.query("restore_timestamp_in_utc", restore_timestamp_in_utc, 'str') + _params['restoreTimestampInUtc'] = _SERIALIZER.query("restore_timestamp_in_utc", restore_timestamp_in_utc, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class RestorableSqlResourcesOperations(object): - """RestorableSqlResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RestorableSqlResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_sql_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -98,7 +98,7 @@ def list( restore_location: Optional[str] = None, restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RestorableSqlResourcesListResult"]: + ) -> Iterable[_models.RestorableSqlResourcesListResult]: """Return a list of database and container combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires @@ -121,13 +121,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlResourcesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RestorableSqlResourcesListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableSqlResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -139,9 +142,11 @@ def prepare_request(next_link=None): restore_location=restore_location, restore_timestamp_in_utc=restore_timestamp_in_utc, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -153,9 +158,11 @@ def prepare_request(next_link=None): restore_location=restore_location, restore_timestamp_in_utc=restore_timestamp_in_utc, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_table_resources_operations.py deleted file mode 100644 index 28cf9464d15d..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_table_resources_operations.py +++ /dev/null @@ -1,188 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - location: str, - instance_id: str, - *, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTableResources") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str'), - "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if restore_location is not None: - _query_parameters['restoreLocation'] = _SERIALIZER.query("restore_location", restore_location, 'str') - if restore_timestamp_in_utc is not None: - _query_parameters['restoreTimestampInUtc'] = _SERIALIZER.query("restore_timestamp_in_utc", restore_timestamp_in_utc, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class RestorableTableResourcesOperations(object): - """RestorableTableResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RestorableTableResourcesListResult"]: - """Return a list of tables that exist on the account at the given timestamp and location. This - helps in scenarios to validate what resources exist at given timestamp and location. This API - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :param restore_location: The location where the restorable resources are located. Default value - is None. - :type restore_location: str - :param restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :type restore_timestamp_in_utc: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableTableResourcesListResult or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableResourcesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableTableResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableTableResourcesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTableResources"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_tables_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_tables_operations.py deleted file mode 100644 index 20a3aace1142..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_tables_operations.py +++ /dev/null @@ -1,185 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - location: str, - instance_id: str, - *, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTables") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str'), - "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if start_time is not None: - _query_parameters['startTime'] = _SERIALIZER.query("start_time", start_time, 'str') - if end_time is not None: - _query_parameters['endTime'] = _SERIALIZER.query("end_time", end_time, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class RestorableTablesOperations(object): - """RestorableTablesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - location: str, - instance_id: str, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RestorableTablesListResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in - scenario where table was accidentally deleted. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. - :type instance_id: str - :param start_time: Restorable Tables event feed start time. Default value is None. - :type start_time: str - :param end_time: Restorable Tables event feed end time. Default value is None. - :type end_time: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableTablesListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableTablesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableTablesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - start_time=start_time, - end_time=end_time, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - instance_id=instance_id, - api_version=api_version, - start_time=start_time, - end_time=end_time, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RestorableTablesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTables"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_service_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_service_operations.py index c447884dbbc5..a349e817c88a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_service_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_service_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,14 +72,17 @@ def build_create_request_initial( account_name: str, service_name: str, *, - json: JSONType = None, + json: Optional[_models.ServiceResourceCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -91,20 +95,18 @@ def build_create_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -118,9 +120,12 @@ def build_get_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -133,18 +138,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -156,9 +159,12 @@ def build_delete_request_initial( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ServiceOperations(object): - """ServiceOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`service` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -214,7 +216,7 @@ def list( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceResourceListResult"]: + ) -> Iterable[_models.ServiceResourceListResult]: """Gets the status of service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -227,13 +229,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ServiceResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -243,9 +248,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -255,9 +262,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -295,17 +304,20 @@ def _create_initial( resource_group_name: str, account_name: str, service_name: str, - create_update_parameters: "_models.ServiceResourceCreateUpdateParameters", + create_update_parameters: _models.ServiceResourceCreateUpdateParameters, **kwargs: Any - ) -> Optional["_models.ServiceResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServiceResource"]] + ) -> Optional[_models.ServiceResource]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ServiceResource]] _json = self._serialize.body(create_update_parameters, 'ServiceResourceCreateUpdateParameters') @@ -318,11 +330,13 @@ def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -351,9 +365,9 @@ def begin_create( resource_group_name: str, account_name: str, service_name: str, - create_update_parameters: "_models.ServiceResourceCreateUpdateParameters", + create_update_parameters: _models.ServiceResourceCreateUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + ) -> LROPoller[_models.ServiceResource]: """Creates a service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -378,17 +392,20 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, service_name=service_name, @@ -396,20 +413,27 @@ def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -429,7 +453,7 @@ def get( account_name: str, service_name: str, **kwargs: Any - ) -> "_models.ServiceResource": + ) -> _models.ServiceResource: """Gets the status of service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -443,13 +467,16 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.ServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] request = build_get_request( @@ -459,11 +486,13 @@ def get( service_name=service_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -491,13 +520,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -507,11 +539,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -556,21 +590,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, service_name=service_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -580,8 +619,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( 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 e8d05b76a58b..5d2d7f6ef490 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_sql_databases_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_sql_databases_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_sql_database_request( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_sql_database_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_update_sql_database_request_initial( account_name: str, database_name: str, *, - json: JSONType = None, + json: Optional[_models.SqlDatabaseCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_update_sql_database_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,8 +159,9 @@ def build_delete_sql_database_request_initial( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,13 +174,12 @@ def build_delete_sql_database_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -188,9 +191,12 @@ def build_get_sql_database_throughput_request( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -203,18 +209,16 @@ def build_get_sql_database_throughput_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -225,14 +229,17 @@ def build_update_sql_database_throughput_request_initial( account_name: str, database_name: str, *, - json: JSONType = None, + json: Optional[_models.ThroughputSettingsUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -245,20 +252,18 @@ def build_update_sql_database_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -272,9 +277,12 @@ def build_migrate_sql_database_to_autoscale_request_initial( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long path_format_arguments = { @@ -287,18 +295,16 @@ def build_migrate_sql_database_to_autoscale_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -310,9 +316,12 @@ def build_migrate_sql_database_to_manual_throughput_request_initial( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long path_format_arguments = { @@ -325,144 +334,16 @@ def build_migrate_sql_database_to_manual_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_client_encryption_keys_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_client_encryption_key_request( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - client_encryption_key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "clientEncryptionKeyName": _SERIALIZER.url("client_encryption_key_name", client_encryption_key_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_update_client_encryption_key_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - client_encryption_key_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "clientEncryptionKeyName": _SERIALIZER.url("client_encryption_key_name", client_encryption_key_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, + params=_params, + headers=_headers, **kwargs ) @@ -474,9 +355,12 @@ def build_list_sql_containers_request( database_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers") # pylint: disable=line-too-long path_format_arguments = { @@ -489,18 +373,16 @@ def build_list_sql_containers_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -513,9 +395,12 @@ def build_get_sql_container_request( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") # pylint: disable=line-too-long path_format_arguments = { @@ -529,18 +414,16 @@ def build_get_sql_container_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -552,14 +435,17 @@ def build_create_update_sql_container_request_initial( database_name: str, container_name: str, *, - json: JSONType = None, + json: Optional[_models.SqlContainerCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") # pylint: disable=line-too-long path_format_arguments = { @@ -573,20 +459,18 @@ def build_create_update_sql_container_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -601,8 +485,9 @@ def build_delete_sql_container_request_initial( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") # pylint: disable=line-too-long path_format_arguments = { @@ -616,61 +501,12 @@ def build_delete_sql_container_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - **kwargs - ) - - -def build_list_sql_container_partition_merge_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, + params=_params, **kwargs ) @@ -683,9 +519,12 @@ def build_get_sql_container_throughput_request( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -699,18 +538,16 @@ def build_get_sql_container_throughput_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -722,14 +559,17 @@ def build_update_sql_container_throughput_request_initial( database_name: str, container_name: str, *, - json: JSONType = None, + json: Optional[_models.ThroughputSettingsUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -743,20 +583,18 @@ def build_update_sql_container_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -771,9 +609,12 @@ def build_migrate_sql_container_to_autoscale_request_initial( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long path_format_arguments = { @@ -787,18 +628,16 @@ def build_migrate_sql_container_to_autoscale_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -811,103 +650,14 @@ def build_migrate_sql_container_to_manual_throughput_request_initial( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sql_container_retrieve_throughput_distribution_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") -def build_sql_container_redistribute_throughput_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -919,22 +669,16 @@ def build_sql_container_redistribute_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, + params=_params, + headers=_headers, **kwargs ) @@ -947,9 +691,12 @@ def build_list_sql_stored_procedures_request( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures") # pylint: disable=line-too-long path_format_arguments = { @@ -963,18 +710,16 @@ def build_list_sql_stored_procedures_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -988,9 +733,12 @@ def build_get_sql_stored_procedure_request( stored_procedure_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}") # pylint: disable=line-too-long path_format_arguments = { @@ -1005,18 +753,16 @@ def build_get_sql_stored_procedure_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1029,14 +775,17 @@ def build_create_update_sql_stored_procedure_request_initial( container_name: str, stored_procedure_name: str, *, - json: JSONType = None, + json: Optional[_models.SqlStoredProcedureCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}") # pylint: disable=line-too-long path_format_arguments = { @@ -1051,20 +800,18 @@ def build_create_update_sql_stored_procedure_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -1080,8 +827,9 @@ def build_delete_sql_stored_procedure_request_initial( stored_procedure_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}") # pylint: disable=line-too-long path_format_arguments = { @@ -1096,13 +844,12 @@ def build_delete_sql_stored_procedure_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -1115,9 +862,12 @@ def build_list_sql_user_defined_functions_request( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions") # pylint: disable=line-too-long path_format_arguments = { @@ -1131,18 +881,16 @@ def build_list_sql_user_defined_functions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1156,9 +904,12 @@ def build_get_sql_user_defined_function_request( user_defined_function_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -1173,18 +924,16 @@ def build_get_sql_user_defined_function_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1197,14 +946,17 @@ def build_create_update_sql_user_defined_function_request_initial( container_name: str, user_defined_function_name: str, *, - json: JSONType = None, + json: Optional[_models.SqlUserDefinedFunctionCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -1219,20 +971,18 @@ def build_create_update_sql_user_defined_function_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -1248,8 +998,9 @@ def build_delete_sql_user_defined_function_request_initial( user_defined_function_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -1264,13 +1015,12 @@ def build_delete_sql_user_defined_function_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -1283,9 +1033,12 @@ def build_list_sql_triggers_request( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers") # pylint: disable=line-too-long path_format_arguments = { @@ -1299,18 +1052,16 @@ def build_list_sql_triggers_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1324,9 +1075,12 @@ def build_get_sql_trigger_request( trigger_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}") # pylint: disable=line-too-long path_format_arguments = { @@ -1341,18 +1095,16 @@ def build_get_sql_trigger_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1365,14 +1117,17 @@ def build_create_update_sql_trigger_request_initial( container_name: str, trigger_name: str, *, - json: JSONType = None, + json: Optional[_models.SqlTriggerCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}") # pylint: disable=line-too-long path_format_arguments = { @@ -1387,20 +1142,18 @@ def build_create_update_sql_trigger_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -1416,8 +1169,9 @@ def build_delete_sql_trigger_request_initial( trigger_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}") # pylint: disable=line-too-long path_format_arguments = { @@ -1432,13 +1186,12 @@ def build_delete_sql_trigger_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -1450,9 +1203,12 @@ def build_get_sql_role_definition_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}") # pylint: disable=line-too-long path_format_arguments = { @@ -1465,18 +1221,16 @@ def build_get_sql_role_definition_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1487,14 +1241,17 @@ def build_create_update_sql_role_definition_request_initial( resource_group_name: str, account_name: str, *, - json: JSONType = None, + json: Optional[_models.SqlRoleDefinitionCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}") # pylint: disable=line-too-long path_format_arguments = { @@ -1507,20 +1264,18 @@ def build_create_update_sql_role_definition_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -1534,9 +1289,12 @@ def build_delete_sql_role_definition_request_initial( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}") # pylint: disable=line-too-long path_format_arguments = { @@ -1549,18 +1307,16 @@ def build_delete_sql_role_definition_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1571,9 +1327,12 @@ def build_list_sql_role_definitions_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions") # pylint: disable=line-too-long path_format_arguments = { @@ -1585,18 +1344,16 @@ def build_list_sql_role_definitions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1608,9 +1365,12 @@ def build_get_sql_role_assignment_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}") # pylint: disable=line-too-long path_format_arguments = { @@ -1623,18 +1383,16 @@ def build_get_sql_role_assignment_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1645,14 +1403,17 @@ def build_create_update_sql_role_assignment_request_initial( resource_group_name: str, account_name: str, *, - json: JSONType = None, + json: Optional[_models.SqlRoleAssignmentCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}") # pylint: disable=line-too-long path_format_arguments = { @@ -1665,20 +1426,18 @@ def build_create_update_sql_role_assignment_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -1692,9 +1451,12 @@ def build_delete_sql_role_assignment_request_initial( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}") # pylint: disable=line-too-long path_format_arguments = { @@ -1707,18 +1469,16 @@ def build_delete_sql_role_assignment_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1729,9 +1489,12 @@ def build_list_sql_role_assignments_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments") # pylint: disable=line-too-long path_format_arguments = { @@ -1743,18 +1506,16 @@ def build_list_sql_role_assignments_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -1766,14 +1527,17 @@ def build_retrieve_continuous_backup_information_request_initial( database_name: str, container_name: str, *, - json: JSONType = None, + json: Optional[_models.ContinuousBackupRestoreLocation] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation") # pylint: disable=line-too-long path_format_arguments = { @@ -1787,46 +1551,42 @@ def build_retrieve_continuous_backup_information_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class SqlResourcesOperations(object): # pylint: disable=too-many-public-methods - """SqlResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SqlResourcesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`sql_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_sql_databases( @@ -1834,7 +1594,7 @@ def list_sql_databases( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.SqlDatabaseListResult"]: + ) -> 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. @@ -1847,13 +1607,16 @@ def list_sql_databases( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1863,9 +1626,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_sql_databases.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1875,9 +1640,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1917,7 +1684,7 @@ def get_sql_database( account_name: str, database_name: str, **kwargs: Any - ) -> "_models.SqlDatabaseGetResults": + ) -> _models.SqlDatabaseGetResults: """Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. @@ -1932,13 +1699,16 @@ def get_sql_database( :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlDatabaseGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlDatabaseGetResults] request = build_get_sql_database_request( @@ -1948,11 +1718,13 @@ def get_sql_database( database_name=database_name, api_version=api_version, template_url=self.get_sql_database.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1978,17 +1750,20 @@ 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: Any - ) -> Optional["_models.SqlDatabaseGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlDatabaseGetResults"]] + ) -> Optional[_models.SqlDatabaseGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlDatabaseGetResults]] _json = self._serialize.body(create_update_sql_database_parameters, 'SqlDatabaseCreateUpdateParameters') @@ -2001,11 +1776,13 @@ def _create_update_sql_database_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2034,9 +1811,9 @@ 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: Any - ) -> LROPoller["_models.SqlDatabaseGetResults"]: + ) -> 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. @@ -2062,17 +1839,20 @@ def begin_create_update_sql_database( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlDatabaseGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlDatabaseGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_sql_database_initial( + raw_result = self._create_update_sql_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2080,20 +1860,27 @@ def begin_create_update_sql_database( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlDatabaseGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2113,13 +1900,16 @@ def _delete_sql_database_initial( # pylint: disable=inconsistent-return-stateme database_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_database_request_initial( @@ -2129,11 +1919,13 @@ def _delete_sql_database_initial( # pylint: disable=inconsistent-return-stateme database_name=database_name, api_version=api_version, template_url=self._delete_sql_database_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2178,21 +1970,26 @@ def begin_delete_sql_database( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_sql_database_initial( + raw_result = self._delete_sql_database_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2202,8 +1999,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2223,7 +2026,7 @@ def get_sql_database_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> "_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. @@ -2238,13 +2041,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_sql_database_throughput_request( @@ -2254,11 +2060,13 @@ def get_sql_database_throughput( database_name=database_name, api_version=api_version, template_url=self.get_sql_database_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2284,17 +2092,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -2307,11 +2118,13 @@ def _update_sql_database_throughput_initial( content_type=content_type, json=_json, template_url=self._update_sql_database_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2340,9 +2153,9 @@ 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: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -2368,17 +2181,20 @@ def begin_update_sql_database_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_sql_database_throughput_initial( + raw_result = self._update_sql_database_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2386,20 +2202,27 @@ def begin_update_sql_database_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2418,14 +2241,17 @@ def _migrate_sql_database_to_autoscale_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_sql_database_to_autoscale_request_initial( @@ -2435,11 +2261,13 @@ def _migrate_sql_database_to_autoscale_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_sql_database_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2469,7 +2297,7 @@ def begin_migrate_sql_database_to_autoscale( account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -2491,35 +2319,45 @@ def begin_migrate_sql_database_to_autoscale( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_sql_database_to_autoscale_initial( + raw_result = self._migrate_sql_database_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2538,14 +2376,17 @@ def _migrate_sql_database_to_manual_throughput_initial( account_name: str, database_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_sql_database_to_manual_throughput_request_initial( @@ -2555,11 +2396,13 @@ def _migrate_sql_database_to_manual_throughput_initial( database_name=database_name, api_version=api_version, template_url=self._migrate_sql_database_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2589,7 +2432,7 @@ def begin_migrate_sql_database_to_manual_throughput( account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -2611,330 +2454,45 @@ def begin_migrate_sql_database_to_manual_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_sql_database_to_manual_throughput_initial( + raw_result = self._migrate_sql_database_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_sql_database_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - @distributed_trace - def list_client_encryption_keys( - self, - resource_group_name: str, - account_name: str, - database_name: str, - **kwargs: Any - ) -> Iterable["_models.ClientEncryptionKeysListResult"]: - """Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClientEncryptionKeysListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeysListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientEncryptionKeysListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, - request = build_list_client_encryption_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - api_version=api_version, - template_url=self.list_client_encryption_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - request = build_list_client_encryption_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ClientEncryptionKeysListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_client_encryption_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys"} # type: ignore - - @distributed_trace - def get_client_encryption_key( - self, - resource_group_name: str, - account_name: str, - database_name: str, - client_encryption_key_name: str, - **kwargs: Any - ) -> "_models.ClientEncryptionKeyGetResults": - """Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. - :type client_encryption_key_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ClientEncryptionKeyGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientEncryptionKeyGetResults"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_client_encryption_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - client_encryption_key_name=client_encryption_key_name, - api_version=api_version, - template_url=self.get_client_encryption_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ClientEncryptionKeyGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_client_encryption_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore - - - def _create_update_client_encryption_key_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: "_models.ClientEncryptionKeyCreateUpdateParameters", - **kwargs: Any - ) -> Optional["_models.ClientEncryptionKeyGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ClientEncryptionKeyGetResults"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(create_update_client_encryption_key_parameters, 'ClientEncryptionKeyCreateUpdateParameters') - - request = build_create_update_client_encryption_key_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - client_encryption_key_name=client_encryption_key_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_update_client_encryption_key_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ClientEncryptionKeyGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_client_encryption_key_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore - - - @distributed_trace - def begin_create_update_client_encryption_key( - self, - resource_group_name: str, - account_name: str, - database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: "_models.ClientEncryptionKeyCreateUpdateParameters", - **kwargs: Any - ) -> LROPoller["_models.ClientEncryptionKeyGetResults"]: - """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the - Azure Powershell (instead of directly). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 ClientEncryptionKeyGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientEncryptionKeyGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_update_client_encryption_key_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - client_encryption_key_name=client_encryption_key_name, - create_update_client_encryption_key_parameters=create_update_client_encryption_key_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ClientEncryptionKeyGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2945,7 +2503,7 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_update_client_encryption_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore + begin_migrate_sql_database_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace def list_sql_containers( @@ -2954,7 +2512,7 @@ def list_sql_containers( account_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.SqlContainerListResult"]: + ) -> 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. @@ -2969,13 +2527,16 @@ def list_sql_containers( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2986,9 +2547,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=self.list_sql_containers.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2999,9 +2562,11 @@ def prepare_request(next_link=None): database_name=database_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -3042,7 +2607,7 @@ def get_sql_container( database_name: str, container_name: str, **kwargs: Any - ) -> "_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. @@ -3058,13 +2623,16 @@ def get_sql_container( :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlContainerGetResults] request = build_get_sql_container_request( @@ -3075,11 +2643,13 @@ def get_sql_container( container_name=container_name, api_version=api_version, template_url=self.get_sql_container.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3106,17 +2676,20 @@ 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: Any - ) -> Optional["_models.SqlContainerGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlContainerGetResults"]] + ) -> Optional[_models.SqlContainerGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlContainerGetResults]] _json = self._serialize.body(create_update_sql_container_parameters, 'SqlContainerCreateUpdateParameters') @@ -3130,11 +2703,13 @@ def _create_update_sql_container_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_container_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3164,9 +2739,9 @@ 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: Any - ) -> LROPoller["_models.SqlContainerGetResults"]: + ) -> 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. @@ -3194,17 +2769,20 @@ def begin_create_update_sql_container( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlContainerGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlContainerGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_sql_container_initial( + raw_result = self._create_update_sql_container_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3213,20 +2791,27 @@ def begin_create_update_sql_container( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlContainerGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3247,13 +2832,16 @@ def _delete_sql_container_initial( # pylint: disable=inconsistent-return-statem container_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_container_request_initial( @@ -3264,503 +2852,39 @@ def _delete_sql_container_initial( # pylint: disable=inconsistent-return-statem container_name=container_name, api_version=api_version, template_url=self._delete_sql_container_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_sql_container_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - - - @distributed_trace - def begin_delete_sql_container( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_sql_container_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_sql_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - - def _list_sql_container_partition_merge_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: "_models.MergeParameters", - **kwargs: Any - ) -> Optional["_models.PhysicalPartitionStorageInfoCollection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionStorageInfoCollection"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(merge_parameters, 'MergeParameters') - - request = build_list_sql_container_partition_merge_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._list_sql_container_partition_merge_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _list_sql_container_partition_merge_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge"} # type: ignore - - - @distributed_trace - def begin_list_sql_container_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: "_models.MergeParameters", - **kwargs: Any - ) -> LROPoller["_models.PhysicalPartitionStorageInfoCollection"]: - """Merges the partitions of a SQL Container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :param merge_parameters: The parameters for the merge operation. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 PhysicalPartitionStorageInfoCollection or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionStorageInfoCollection"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._list_sql_container_partition_merge_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - merge_parameters=merge_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_list_sql_container_partition_merge.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge"} # type: ignore - - @distributed_trace - def get_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": - """Gets the RUs per second of 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ThroughputSettingsGetResults, or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_get_sql_container_throughput_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - template_url=self.get_sql_container_throughput.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_sql_container_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - - def _update_sql_container_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') - - request = build_update_sql_container_throughput_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_sql_container_throughput_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_sql_container_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - - @distributed_trace - def begin_update_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: "_models.ThroughputSettingsUpdateParameters", - **kwargs: Any - ) -> 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. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param database_name: Cosmos DB database name. - :type database_name: str - :param container_name: Cosmos DB container name. - :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_sql_container_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - update_throughput_parameters=update_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_sql_container_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - def _migrate_sql_container_to_autoscale_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - **kwargs: Any - ) -> 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 = kwargs.pop('api_version', "2022-02-15-preview") # type: str - - - request = build_migrate_sql_container_to_autoscale_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - template_url=self._migrate_sql_container_to_autoscale_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, {}) - _migrate_sql_container_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _delete_sql_container_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore @distributed_trace - def begin_migrate_sql_container_to_autoscale( + def begin_delete_sql_container( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -3778,41 +2902,48 @@ def begin_migrate_sql_container_to_autoscale( :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 ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_sql_container_to_autoscale_initial( + raw_result = self._delete_sql_container_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3823,38 +2954,120 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_sql_container_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_delete_sql_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore - def _migrate_sql_container_to_manual_throughput_initial( + @distributed_trace + def get_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of 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. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_name: Cosmos DB database name. + :type database_name: str + :param container_name: Cosmos DB container name. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ThroughputSettingsGetResults, or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :raises: ~azure.core.exceptions.HttpResponseError + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] - request = build_migrate_sql_container_to_manual_throughput_request_initial( + request = build_get_sql_container_throughput_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, api_version=api_version, - template_url=self._migrate_sql_container_to_manual_throughput_initial.metadata['url'], + template_url=self.get_sql_container_throughput.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_sql_container_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore + + + def _update_sql_container_throughput_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + **kwargs: Any + ) -> Optional[_models.ThroughputSettingsGetResults]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + + _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') + + request = build_update_sql_container_throughput_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_sql_container_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3874,19 +3087,20 @@ def _migrate_sql_container_to_manual_throughput_initial( return deserialized - _migrate_sql_container_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _update_sql_container_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore @distributed_trace - def begin_migrate_sql_container_to_manual_throughput( + def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: - """Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + ) -> 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. :type resource_group_name: str @@ -3896,6 +3110,10 @@ def begin_migrate_sql_container_to_manual_throughput( :type database_name: str :param container_name: Cosmos DB container name. :type container_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -3909,36 +3127,49 @@ def begin_migrate_sql_container_to_manual_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_sql_container_to_manual_throughput_initial( + raw_result = self._update_sql_container_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, + update_throughput_parameters=update_throughput_parameters, api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -3949,43 +3180,43 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_sql_container_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_update_sql_container_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - def _sql_container_retrieve_throughput_distribution_initial( + def _migrate_sql_container_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - retrieve_throughput_parameters: "_models.RetrieveThroughputParameters", **kwargs: Any - ) -> Optional["_models.PhysicalPartitionThroughputInfoResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionThroughputInfoResult"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(retrieve_throughput_parameters, 'RetrieveThroughputParameters') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - request = build_sql_container_retrieve_throughput_distribution_request_initial( + + request = build_migrate_sql_container_to_autoscale_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._sql_container_retrieve_throughput_distribution_initial.metadata['url'], + template_url=self._migrate_sql_container_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -3998,27 +3229,26 @@ def _sql_container_retrieve_throughput_distribution_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _sql_container_retrieve_throughput_distribution_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore + _migrate_sql_container_to_autoscale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore @distributed_trace - def begin_sql_container_retrieve_throughput_distribution( + def begin_migrate_sql_container_to_autoscale( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - retrieve_throughput_parameters: "_models.RetrieveThroughputParameters", **kwargs: Any - ) -> LROPoller["_models.PhysicalPartitionThroughputInfoResult"]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + ) -> 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. :type resource_group_name: str @@ -4028,9 +3258,6 @@ def begin_sql_container_retrieve_throughput_distribution( :type database_name: str :param container_name: Cosmos DB container name. :type container_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL container. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -4039,45 +3266,51 @@ def begin_sql_container_retrieve_throughput_distribution( :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 PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionThroughputInfoResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._sql_container_retrieve_throughput_distribution_initial( + raw_result = self._migrate_sql_container_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -4088,43 +3321,43 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_sql_container_retrieve_throughput_distribution.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore + begin_migrate_sql_container_to_autoscale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - def _sql_container_redistribute_throughput_initial( + def _migrate_sql_container_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - redistribute_throughput_parameters: "_models.RedistributeThroughputParameters", **kwargs: Any - ) -> Optional["_models.PhysicalPartitionThroughputInfoResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionThroughputInfoResult"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(redistribute_throughput_parameters, 'RedistributeThroughputParameters') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - request = build_sql_container_redistribute_throughput_request_initial( + + request = build_migrate_sql_container_to_manual_throughput_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._sql_container_redistribute_throughput_initial.metadata['url'], + template_url=self._migrate_sql_container_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4137,27 +3370,26 @@ def _sql_container_redistribute_throughput_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _sql_container_redistribute_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput"} # type: ignore + _migrate_sql_container_to_manual_throughput_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace - def begin_sql_container_redistribute_throughput( + def begin_migrate_sql_container_to_manual_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - redistribute_throughput_parameters: "_models.RedistributeThroughputParameters", **kwargs: Any - ) -> LROPoller["_models.PhysicalPartitionThroughputInfoResult"]: - """Redistribute throughput for an Azure Cosmos DB SQL container. + ) -> 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. :type resource_group_name: str @@ -4167,10 +3399,6 @@ def begin_sql_container_redistribute_throughput( :type database_name: str :param container_name: Cosmos DB container name. :type container_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL container. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters :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: By default, your polling method will be ARMPolling. Pass in False for this @@ -4179,45 +3407,51 @@ def begin_sql_container_redistribute_throughput( :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 PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionThroughputInfoResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._sql_container_redistribute_throughput_initial( + raw_result = self._migrate_sql_container_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PhysicalPartitionThroughputInfoResult', pipeline_response) + deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -4228,7 +3462,7 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_sql_container_redistribute_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput"} # type: ignore + begin_migrate_sql_container_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore @distributed_trace def list_sql_stored_procedures( @@ -4238,7 +3472,7 @@ def list_sql_stored_procedures( database_name: str, container_name: str, **kwargs: Any - ) -> Iterable["_models.SqlStoredProcedureListResult"]: + ) -> 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. @@ -4255,13 +3489,16 @@ def list_sql_stored_procedures( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlStoredProcedureListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -4273,9 +3510,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=self.list_sql_stored_procedures.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -4287,9 +3526,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -4331,7 +3572,7 @@ def get_sql_stored_procedure( container_name: str, stored_procedure_name: str, **kwargs: Any - ) -> "_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. @@ -4349,13 +3590,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlStoredProcedureGetResults] request = build_get_sql_stored_procedure_request( @@ -4367,11 +3611,13 @@ def get_sql_stored_procedure( stored_procedure_name=stored_procedure_name, api_version=api_version, template_url=self.get_sql_stored_procedure.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4399,17 +3645,20 @@ 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: Any - ) -> Optional["_models.SqlStoredProcedureGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlStoredProcedureGetResults"]] + ) -> Optional[_models.SqlStoredProcedureGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlStoredProcedureGetResults]] _json = self._serialize.body(create_update_sql_stored_procedure_parameters, 'SqlStoredProcedureCreateUpdateParameters') @@ -4424,11 +3673,13 @@ def _create_update_sql_stored_procedure_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_stored_procedure_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4459,9 +3710,9 @@ 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: Any - ) -> LROPoller["_models.SqlStoredProcedureGetResults"]: + ) -> 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. @@ -4491,17 +3742,20 @@ def begin_create_update_sql_stored_procedure( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlStoredProcedureGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlStoredProcedureGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_sql_stored_procedure_initial( + raw_result = self._create_update_sql_stored_procedure_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4511,20 +3765,27 @@ def begin_create_update_sql_stored_procedure( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlStoredProcedureGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -4546,13 +3807,16 @@ def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent-return stored_procedure_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_stored_procedure_request_initial( @@ -4564,11 +3828,13 @@ def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent-return stored_procedure_name=stored_procedure_name, api_version=api_version, template_url=self._delete_sql_stored_procedure_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4619,16 +3885,19 @@ def begin_delete_sql_stored_procedure( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_sql_stored_procedure_initial( + raw_result = self._delete_sql_stored_procedure_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4636,6 +3905,8 @@ def begin_delete_sql_stored_procedure( # pylint: disable=inconsistent-return-st stored_procedure_name=stored_procedure_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -4645,8 +3916,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -4667,7 +3944,7 @@ def list_sql_user_defined_functions( database_name: str, container_name: str, **kwargs: Any - ) -> Iterable["_models.SqlUserDefinedFunctionListResult"]: + ) -> 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. @@ -4685,13 +3962,16 @@ def list_sql_user_defined_functions( ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -4703,9 +3983,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=self.list_sql_user_defined_functions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -4717,9 +3999,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -4761,7 +4045,7 @@ def get_sql_user_defined_function( container_name: str, user_defined_function_name: str, **kwargs: Any - ) -> "_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. @@ -4779,13 +4063,16 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlUserDefinedFunctionGetResults] request = build_get_sql_user_defined_function_request( @@ -4797,11 +4084,13 @@ def get_sql_user_defined_function( user_defined_function_name=user_defined_function_name, api_version=api_version, template_url=self.get_sql_user_defined_function.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4829,17 +4118,20 @@ 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: Any - ) -> Optional["_models.SqlUserDefinedFunctionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlUserDefinedFunctionGetResults"]] + ) -> Optional[_models.SqlUserDefinedFunctionGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlUserDefinedFunctionGetResults]] _json = self._serialize.body(create_update_sql_user_defined_function_parameters, 'SqlUserDefinedFunctionCreateUpdateParameters') @@ -4854,11 +4146,13 @@ def _create_update_sql_user_defined_function_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_user_defined_function_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -4889,9 +4183,9 @@ 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: Any - ) -> LROPoller["_models.SqlUserDefinedFunctionGetResults"]: + ) -> 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. @@ -4922,17 +4216,20 @@ def begin_create_update_sql_user_defined_function( ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlUserDefinedFunctionGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlUserDefinedFunctionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_sql_user_defined_function_initial( + raw_result = self._create_update_sql_user_defined_function_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4942,20 +4239,27 @@ def begin_create_update_sql_user_defined_function( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlUserDefinedFunctionGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -4977,13 +4281,16 @@ def _delete_sql_user_defined_function_initial( # pylint: disable=inconsistent-r user_defined_function_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_user_defined_function_request_initial( @@ -4995,11 +4302,13 @@ def _delete_sql_user_defined_function_initial( # pylint: disable=inconsistent-r user_defined_function_name=user_defined_function_name, api_version=api_version, template_url=self._delete_sql_user_defined_function_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -5050,16 +4359,19 @@ def begin_delete_sql_user_defined_function( # pylint: disable=inconsistent-retu :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_sql_user_defined_function_initial( + raw_result = self._delete_sql_user_defined_function_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -5067,6 +4379,8 @@ def begin_delete_sql_user_defined_function( # pylint: disable=inconsistent-retu user_defined_function_name=user_defined_function_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -5076,8 +4390,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -5098,7 +4418,7 @@ def list_sql_triggers( database_name: str, container_name: str, **kwargs: Any - ) -> Iterable["_models.SqlTriggerListResult"]: + ) -> 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. @@ -5115,13 +4435,16 @@ def list_sql_triggers( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlTriggerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -5133,9 +4456,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=self.list_sql_triggers.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -5147,9 +4472,11 @@ def prepare_request(next_link=None): container_name=container_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -5191,7 +4518,7 @@ def get_sql_trigger( container_name: str, trigger_name: str, **kwargs: Any - ) -> "_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. @@ -5209,13 +4536,16 @@ def get_sql_trigger( :rtype: ~azure.mgmt.cosmosdb.models.SqlTriggerGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlTriggerGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlTriggerGetResults] request = build_get_sql_trigger_request( @@ -5227,11 +4557,13 @@ def get_sql_trigger( trigger_name=trigger_name, api_version=api_version, template_url=self.get_sql_trigger.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -5259,17 +4591,20 @@ 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: Any - ) -> Optional["_models.SqlTriggerGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlTriggerGetResults"]] + ) -> Optional[_models.SqlTriggerGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlTriggerGetResults]] _json = self._serialize.body(create_update_sql_trigger_parameters, 'SqlTriggerCreateUpdateParameters') @@ -5284,11 +4619,13 @@ def _create_update_sql_trigger_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_trigger_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -5319,9 +4656,9 @@ 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: Any - ) -> LROPoller["_models.SqlTriggerGetResults"]: + ) -> 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. @@ -5351,17 +4688,20 @@ def begin_create_update_sql_trigger( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlTriggerGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlTriggerGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_sql_trigger_initial( + raw_result = self._create_update_sql_trigger_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -5371,20 +4711,27 @@ def begin_create_update_sql_trigger( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlTriggerGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -5406,13 +4753,16 @@ def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-statemen trigger_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_trigger_request_initial( @@ -5424,11 +4774,13 @@ def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-statemen trigger_name=trigger_name, api_version=api_version, template_url=self._delete_sql_trigger_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -5479,16 +4831,19 @@ def begin_delete_sql_trigger( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_sql_trigger_initial( + raw_result = self._delete_sql_trigger_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -5496,6 +4851,8 @@ def begin_delete_sql_trigger( # pylint: disable=inconsistent-return-statements trigger_name=trigger_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -5505,8 +4862,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -5526,7 +4889,7 @@ def get_sql_role_definition( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_models.SqlRoleDefinitionGetResults": + ) -> _models.SqlRoleDefinitionGetResults: """Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. :param role_definition_id: The GUID for the Role Definition. @@ -5540,13 +4903,16 @@ def get_sql_role_definition( :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleDefinitionGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleDefinitionGetResults] request = build_get_sql_role_definition_request( @@ -5556,11 +4922,13 @@ def get_sql_role_definition( account_name=account_name, api_version=api_version, template_url=self.get_sql_role_definition.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -5586,17 +4954,20 @@ def _create_update_sql_role_definition_initial( role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: "_models.SqlRoleDefinitionCreateUpdateParameters", + create_update_sql_role_definition_parameters: _models.SqlRoleDefinitionCreateUpdateParameters, **kwargs: Any - ) -> Optional["_models.SqlRoleDefinitionGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlRoleDefinitionGetResults"]] + ) -> Optional[_models.SqlRoleDefinitionGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlRoleDefinitionGetResults]] _json = self._serialize.body(create_update_sql_role_definition_parameters, 'SqlRoleDefinitionCreateUpdateParameters') @@ -5609,11 +4980,13 @@ def _create_update_sql_role_definition_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_role_definition_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -5642,9 +5015,9 @@ def begin_create_update_sql_role_definition( role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: "_models.SqlRoleDefinitionCreateUpdateParameters", + create_update_sql_role_definition_parameters: _models.SqlRoleDefinitionCreateUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.SqlRoleDefinitionGetResults"]: + ) -> LROPoller[_models.SqlRoleDefinitionGetResults]: """Creates or updates an Azure Cosmos DB SQL Role Definition. :param role_definition_id: The GUID for the Role Definition. @@ -5670,17 +5043,20 @@ def begin_create_update_sql_role_definition( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleDefinitionGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleDefinitionGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_sql_role_definition_initial( + raw_result = self._create_update_sql_role_definition_initial( # type: ignore role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, @@ -5688,20 +5064,27 @@ def begin_create_update_sql_role_definition( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlRoleDefinitionGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -5721,13 +5104,16 @@ def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-return- account_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_role_definition_request_initial( @@ -5737,11 +5123,13 @@ def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-return- account_name=account_name, api_version=api_version, template_url=self._delete_sql_role_definition_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -5786,21 +5174,26 @@ def begin_delete_sql_role_definition( # pylint: disable=inconsistent-return-sta :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_sql_role_definition_initial( + raw_result = self._delete_sql_role_definition_initial( # type: ignore role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -5810,8 +5203,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -5830,7 +5229,7 @@ def list_sql_role_definitions( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.SqlRoleDefinitionListResult"]: + ) -> Iterable[_models.SqlRoleDefinitionListResult]: """Retrieves the list of all Azure Cosmos DB SQL Role Definitions. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -5843,13 +5242,16 @@ def list_sql_role_definitions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -5859,9 +5261,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_sql_role_definitions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -5871,9 +5275,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -5913,7 +5319,7 @@ def get_sql_role_assignment( resource_group_name: str, account_name: str, **kwargs: Any - ) -> "_models.SqlRoleAssignmentGetResults": + ) -> _models.SqlRoleAssignmentGetResults: """Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. :param role_assignment_id: The GUID for the Role Assignment. @@ -5927,13 +5333,16 @@ def get_sql_role_assignment( :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleAssignmentGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleAssignmentGetResults] request = build_get_sql_role_assignment_request( @@ -5943,11 +5352,13 @@ def get_sql_role_assignment( account_name=account_name, api_version=api_version, template_url=self.get_sql_role_assignment.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -5973,17 +5384,20 @@ def _create_update_sql_role_assignment_initial( role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: "_models.SqlRoleAssignmentCreateUpdateParameters", + create_update_sql_role_assignment_parameters: _models.SqlRoleAssignmentCreateUpdateParameters, **kwargs: Any - ) -> Optional["_models.SqlRoleAssignmentGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlRoleAssignmentGetResults"]] + ) -> Optional[_models.SqlRoleAssignmentGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SqlRoleAssignmentGetResults]] _json = self._serialize.body(create_update_sql_role_assignment_parameters, 'SqlRoleAssignmentCreateUpdateParameters') @@ -5996,11 +5410,13 @@ def _create_update_sql_role_assignment_initial( content_type=content_type, json=_json, template_url=self._create_update_sql_role_assignment_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -6029,9 +5445,9 @@ def begin_create_update_sql_role_assignment( role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: "_models.SqlRoleAssignmentCreateUpdateParameters", + create_update_sql_role_assignment_parameters: _models.SqlRoleAssignmentCreateUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.SqlRoleAssignmentGetResults"]: + ) -> LROPoller[_models.SqlRoleAssignmentGetResults]: """Creates or updates an Azure Cosmos DB SQL Role Assignment. :param role_assignment_id: The GUID for the Role Assignment. @@ -6057,17 +5473,20 @@ def begin_create_update_sql_role_assignment( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleAssignmentGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleAssignmentGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_sql_role_assignment_initial( + raw_result = self._create_update_sql_role_assignment_initial( # type: ignore role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, @@ -6075,20 +5494,27 @@ def begin_create_update_sql_role_assignment( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SqlRoleAssignmentGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -6108,13 +5534,16 @@ def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-return- account_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_sql_role_assignment_request_initial( @@ -6124,11 +5553,13 @@ def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-return- account_name=account_name, api_version=api_version, template_url=self._delete_sql_role_assignment_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -6173,21 +5604,26 @@ def begin_delete_sql_role_assignment( # pylint: disable=inconsistent-return-sta :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_sql_role_assignment_initial( + raw_result = self._delete_sql_role_assignment_initial( # type: ignore role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -6197,8 +5633,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -6217,7 +5659,7 @@ def list_sql_role_assignments( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.SqlRoleAssignmentListResult"]: + ) -> Iterable[_models.SqlRoleAssignmentListResult]: """Retrieves the list of all Azure Cosmos DB SQL Role Assignments. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6230,13 +5672,16 @@ def list_sql_role_assignments( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlRoleAssignmentListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlRoleAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -6246,9 +5691,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_sql_role_assignments.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -6258,9 +5705,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -6299,17 +5748,20 @@ def _retrieve_continuous_backup_information_initial( account_name: str, database_name: str, container_name: str, - location: "_models.ContinuousBackupRestoreLocation", + location: _models.ContinuousBackupRestoreLocation, **kwargs: Any - ) -> Optional["_models.BackupInformation"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInformation"]] + ) -> Optional[_models.BackupInformation]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.BackupInformation]] _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') @@ -6323,11 +5775,13 @@ def _retrieve_continuous_backup_information_initial( content_type=content_type, json=_json, template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -6357,9 +5811,9 @@ def begin_retrieve_continuous_backup_information( account_name: str, database_name: str, container_name: str, - location: "_models.ContinuousBackupRestoreLocation", + location: _models.ContinuousBackupRestoreLocation, **kwargs: Any - ) -> LROPoller["_models.BackupInformation"]: + ) -> LROPoller[_models.BackupInformation]: """Retrieves continuous backup information for a container resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6385,17 +5839,20 @@ def begin_retrieve_continuous_backup_information( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupInformation] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInformation"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._retrieve_continuous_backup_information_initial( + raw_result = self._retrieve_continuous_backup_information_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -6404,20 +5861,27 @@ def begin_retrieve_continuous_backup_information( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BackupInformation', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_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 03bece7f1099..f61903a736e1 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_tables_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_tables_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_table_request( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_table_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_update_table_request_initial( account_name: str, table_name: str, *, - json: JSONType = None, + json: Optional[_models.TableCreateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_update_table_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,8 +159,9 @@ def build_delete_table_request_initial( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,13 +174,12 @@ def build_delete_table_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -188,9 +191,12 @@ def build_get_table_throughput_request( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -203,18 +209,16 @@ def build_get_table_throughput_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -225,14 +229,17 @@ def build_update_table_throughput_request_initial( account_name: str, table_name: str, *, - json: JSONType = None, + json: Optional[_models.ThroughputSettingsUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") # pylint: disable=line-too-long path_format_arguments = { @@ -245,20 +252,18 @@ def build_update_table_throughput_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -272,9 +277,12 @@ def build_migrate_table_to_autoscale_request_initial( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale") # pylint: disable=line-too-long path_format_arguments = { @@ -287,18 +295,16 @@ def build_migrate_table_to_autoscale_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -310,53 +316,14 @@ def build_migrate_table_to_manual_throughput_request_initial( table_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), - "tableName": _SERIALIZER.url("table_name", table_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + accept = _headers.pop('Accept', "application/json") - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_retrieve_continuous_backup_information_request_initial( - subscription_id: str, - resource_group_name: str, - account_name: str, - table_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -367,46 +334,38 @@ def build_retrieve_continuous_backup_information_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, + params=_params, + headers=_headers, **kwargs ) -class TableResourcesOperations(object): - """TableResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class TableResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cosmosdb.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`table_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_tables( @@ -414,7 +373,7 @@ def list_tables( resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.TableListResult"]: + ) -> 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. @@ -426,13 +385,16 @@ def list_tables( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + 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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -442,9 +404,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=self.list_tables.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -454,9 +418,11 @@ def prepare_request(next_link=None): account_name=account_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -496,7 +462,7 @@ def get_table( account_name: str, table_name: str, **kwargs: Any - ) -> "_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. @@ -510,13 +476,16 @@ def get_table( :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TableGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TableGetResults] request = build_get_table_request( @@ -526,11 +495,13 @@ def get_table( table_name=table_name, api_version=api_version, template_url=self.get_table.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -556,17 +527,20 @@ 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: Any - ) -> Optional["_models.TableGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.TableGetResults"]] + ) -> Optional[_models.TableGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.TableGetResults]] _json = self._serialize.body(create_update_table_parameters, 'TableCreateUpdateParameters') @@ -579,11 +553,13 @@ def _create_update_table_initial( content_type=content_type, json=_json, template_url=self._create_update_table_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -612,9 +588,9 @@ 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: Any - ) -> LROPoller["_models.TableGetResults"]: + ) -> 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. @@ -638,17 +614,20 @@ def begin_create_update_table( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TableGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TableGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_update_table_initial( + raw_result = self._create_update_table_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -656,20 +635,27 @@ def begin_create_update_table( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('TableGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -689,13 +675,16 @@ def _delete_table_initial( # pylint: disable=inconsistent-return-statements table_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_table_request_initial( @@ -705,11 +694,13 @@ def _delete_table_initial( # pylint: disable=inconsistent-return-statements table_name=table_name, api_version=api_version, template_url=self._delete_table_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -754,21 +745,26 @@ def begin_delete_table( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_table_initial( + raw_result = self._delete_table_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -778,8 +774,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -799,7 +801,7 @@ def get_table_throughput( account_name: str, table_name: str, **kwargs: Any - ) -> "_models.ThroughputSettingsGetResults": + ) -> _models.ThroughputSettingsGetResults: """Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. @@ -814,13 +816,16 @@ def get_table_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] request = build_get_table_throughput_request( @@ -830,11 +835,13 @@ def get_table_throughput( table_name=table_name, api_version=api_version, template_url=self.get_table_throughput.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -860,17 +867,20 @@ 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: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] _json = self._serialize.body(update_throughput_parameters, 'ThroughputSettingsUpdateParameters') @@ -883,11 +893,13 @@ def _update_table_throughput_initial( content_type=content_type, json=_json, template_url=self._update_table_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -916,9 +928,9 @@ 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: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -944,17 +956,20 @@ def begin_update_table_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_table_throughput_initial( + raw_result = self._update_table_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -962,20 +977,27 @@ def begin_update_table_throughput( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -994,14 +1016,17 @@ def _migrate_table_to_autoscale_initial( account_name: str, table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_table_to_autoscale_request_initial( @@ -1011,11 +1036,13 @@ def _migrate_table_to_autoscale_initial( table_name=table_name, api_version=api_version, template_url=self._migrate_table_to_autoscale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1045,7 +1072,7 @@ def begin_migrate_table_to_autoscale( account_name: str, table_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -1067,35 +1094,45 @@ def begin_migrate_table_to_autoscale( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_table_to_autoscale_initial( + raw_result = self._migrate_table_to_autoscale_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1114,14 +1151,17 @@ def _migrate_table_to_manual_throughput_initial( account_name: str, table_name: str, **kwargs: Any - ) -> Optional["_models.ThroughputSettingsGetResults"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ThroughputSettingsGetResults"]] + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] request = build_migrate_table_to_manual_throughput_request_initial( @@ -1131,11 +1171,13 @@ def _migrate_table_to_manual_throughput_initial( table_name=table_name, api_version=api_version, template_url=self._migrate_table_to_manual_throughput_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1165,7 +1207,7 @@ def begin_migrate_table_to_manual_throughput( account_name: str, table_name: str, **kwargs: Any - ) -> LROPoller["_models.ThroughputSettingsGetResults"]: + ) -> 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. @@ -1187,166 +1229,45 @@ def begin_migrate_table_to_manual_throughput( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThroughputSettingsGetResults] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThroughputSettingsGetResults"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_table_to_manual_throughput_initial( + raw_result = self._migrate_table_to_manual_throughput_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ThroughputSettingsGetResults', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_table_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - def _retrieve_continuous_backup_information_initial( - self, - resource_group_name: str, - account_name: str, - table_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> Optional["_models.BackupInformation"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInformation"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(location, 'ContinuousBackupRestoreLocation') - - request = build_retrieve_continuous_backup_information_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - account_name=account_name, - table_name=table_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._retrieve_continuous_backup_information_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupInformation', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _retrieve_continuous_backup_information_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation"} # type: ignore - - - @distributed_trace - def begin_retrieve_continuous_backup_information( - self, - resource_group_name: str, - account_name: str, - table_name: str, - location: "_models.ContinuousBackupRestoreLocation", - **kwargs: Any - ) -> LROPoller["_models.BackupInformation"]: - """Retrieves continuous backup information for a table. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. - :type account_name: str - :param table_name: Cosmos DB table name. - :type table_name: str - :param location: The name of the continuous backup restore location. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a 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 BackupInformation or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-02-15-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInformation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._retrieve_continuous_backup_information_initial( - resource_group_name=resource_group_name, - account_name=account_name, - table_name=table_name, - location=location, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BackupInformation', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1357,4 +1278,4 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_retrieve_continuous_backup_information.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation"} # type: ignore + begin_migrate_table_to_manual_throughput.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/setup.py b/sdk/cosmos/azure-mgmt-cosmosdb/setup.py index d1c6abb65c61..a0b02956b3a7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/setup.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/setup.py @@ -72,7 +72,7 @@ install_requires=[ 'msrest>=0.6.21', 'azure-common~=1.1', - 'azure-mgmt-core>=1.3.0,<2.0.0', + 'azure-mgmt-core>=1.3.1,<2.0.0', ], python_requires=">=3.6" ) diff --git a/shared_requirements.txt b/shared_requirements.txt index 28aeac4e7c67..1177727706b7 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -334,7 +334,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-dashboard azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-loganalytics azure-mgmt-core>=1.3.1,<2.0.0 #override azure-mgmt-synapse azure-mgmt-core>=1.3.0,<2.0.0 -#override azure-mgmt-cosmosdb azure-mgmt-core>=1.3.0,<2.0.0 +#override azure-mgmt-cosmosdb azure-mgmt-core>=1.3.1,<2.0.0 #override azure-mgmt-datafactory azure-mgmt-core>=1.3.1,<2.0.0 #override azure-mgmt-scvmm msrest>=0.6.21 #override azure-mgmt-scvmm azure-mgmt-core>=1.3.0,<2.0.0